local y=BrickColor.new("\082\101\097\108\108\121 \114\101\100")local C=BrickColor.new("\082\101\100\100\105\115\104 \098\114\111\119\110")local e=BrickColor.new("\073\110\115\116\105\116\117\116\105\111\110\097\108 \119\104\105\116\101")local E=light_L.BrickColor print("\104\101\097\100\108\105\103\104\116 \111\102\102 \099\111\108\111\114 \119\105\108\108 \098\101 "..E.Name)local c=.5 local s=.1 local O=7 local o=3 function seatChildAddedHandler(y)if y.Name=="\083\101\097\116\087\101\108\100"then print("\084\117\114\110 \099\097\114 \079\078")driverInSeat=true smoke.Enabled=true smoke.Opacity=s light_L.BrickColor=e light_R.BrickColor=e fire.Size=O fire.Enabled=true wait(.3)fire.Size=o if seat.Throttle==0 then fire.Enabled=false end end end function seatChildRemovedHandler(y)if y.Name=="\083\101\097\116\087\101\108\100"then print("\084\117\114\110 \099\097\114 \079\070\070")driverInSeat=false smoke.Enabled=false light_L.BrickColor=E light_R.BrickColor=E end end function showBigFire()fire.Size=O fire.Enabled=true wait(.3)if seat.Throttle==1 then fire.Size=o end wait(1)if seat.Throttle==1 then fire.Enabled=false end end local t=84000 local N=1 function tiltJeepBack()print("\116\105\108\116\074\101\101\112\066\097\099\107\040\041")wait(N)end function tiltJeepForward()print("\116\105\108\116\074\101\101\112\070\111\114\119\097\114\100\040\041")wait(N)end function seatChangedHandler(E)if E=="\084\104\114\111\116\116\108\101"then if seat.Throttle==1 then brake_L.BrickColor=C brake_R.BrickColor=C smoke.Opacity=c local y=coroutine.create(showBigFire)coroutine.resume(y)local e=coroutine.create(tiltJeepBack)coroutine.resume(e)elseif seat.Throttle==0 then brake_L.BrickColor=y brake_R.BrickColor=y smoke.Opacity=s fire.Enabled=false wait(.9)if brake_L.BrickColor==y then brake_L.BrickColor=C end if brake_R.BrickColor==y then brake_R.BrickColor=C end elseif seat.Throttle==-1 then brake_L.BrickColor=e brake_R.BrickColor=e smoke.Opacity=s fire.Enabled=false local y=coroutine.create(tiltJeepForward)coroutine.resume(y)end end end
-- SETTINGS
local brakeColor_on = BrickColor.new("Really red")
local brakeColor_off = BrickColor.new("Reddish brown")
local lightColor_on = BrickColor.new("Institutional white")
local lightColor_off = light_L.BrickColor
print("headlight off color will be " .. lightColor_off.Name)
local smokeOpacity_throttleOn = 0.5
local smokeOpacity_throttleOff = 0.1
local fireSize_big = 7
local fireSize_small = 3

function seatChildAddedHandler(child)
	if child.Name == "SeatWeld" then
		print("Turn car ON")
		driverInSeat = true
		smoke.Enabled = true
		smoke.Opacity = smokeOpacity_throttleOff
		light_L.BrickColor = lightColor_on
		light_R.BrickColor = lightColor_on
		fire.Size = fireSize_big
		fire.Enabled = true
		wait(0.3)
		fire.Size = fireSize_small
		if seat.Throttle == 0 then
			fire.Enabled = false
		end
	end
end

function seatChildRemovedHandler(child)
	if child.Name == "SeatWeld" then
		print("Turn car OFF")
		driverInSeat = false
		smoke.Enabled = false
		light_L.BrickColor = lightColor_off
		light_R.BrickColor = lightColor_off
	end
end

function showBigFire()
	fire.Size = fireSize_big
	fire.Enabled = true
	wait(0.3)
	if seat.Throttle == 1 then
		fire.Size = fireSize_small
	end
	wait(1)
	if seat.Throttle == 1 then
		fire.Enabled = false
	end
end

local tiltForce = 84000
local tiltTime = 1
function tiltJeepBack()
	print("tiltJeepBack()")
	wait(tiltTime)
end

function tiltJeepForward()
	print("tiltJeepForward()")
	wait(tiltTime)
end

function seatChangedHandler(prop)
	if prop == "Throttle" then
		if seat.Throttle == 1 then
			-- Throttle Forward
			brake_L.BrickColor = brakeColor_off
			brake_R.BrickColor = brakeColor_off
			smoke.Opacity = smokeOpacity_throttleOn
			local co = coroutine.create(showBigFire)
			coroutine.resume(co)
			local co2 = coroutine.create(tiltJeepBack)
			coroutine.resume(co2)
		elseif seat.Throttle == 0 then
			-- Throttle Off
			brake_L.BrickColor = brakeColor_on
			brake_R.BrickColor = brakeColor_on
			smoke.Opacity = smokeOpacity_throttleOff
			fire.Enabled = false
			wait(0.9)
			if brake_L.BrickColor == brakeColor_on then
				brake_L.BrickColor = brakeColor_off
			end
			if brake_R.BrickColor == brakeColor_on then
				brake_R.BrickColor = brakeColor_off
			end
		elseif seat.Throttle == -1 then
			-- Throttle Reverse
			brake_L.BrickColor = lightColor_on
			brake_R.BrickColor = lightColor_on
			smoke.Opacity = smokeOpacity_throttleOff
			fire.Enabled = false
			local co = coroutine.create(tiltJeepForward)
			coroutine.resume(co)
		end
	end
end
