local o=script.Parent:WaitForChild("\066\117\116\116\111\110\115")local m=o:WaitForChild("\076\101\102\116")local T=o:WaitForChild("\082\105\103\104\116")local g=o:WaitForChild("\066\114\097\107\101")local z=o:WaitForChild("\071\097\115")local H=o:WaitForChild("\080\066\114\097\107\101\066\117\116\116\111\110")if UserInputService.TouchEnabled then o.Visible=true;(script.Parent:WaitForChild("\071\097\117\103\101")).Visible=false end local function Q(o,m)if o.UserInputState==Enum.UserInputState.Begin then _GSteerT=-1 _SteerL=true else if _SteerR then _GSteerT=1 else _GSteerT=0 end _SteerL=false end end m.InputBegan:Connect(Q)m.InputEnded:Connect(Q)local function W(o,m)if o.UserInputState==Enum.UserInputState.Begin then _GSteerT=1 _SteerR=true else if _SteerL then _GSteerT=-1 else _GSteerT=0 end _SteerR=false end end T.InputBegan:Connect(W)T.InputEnded:Connect(W)local function y(o,m)if o.UserInputState==Enum.UserInputState.Begin and _IsOn then _GThrot=1 else _GThrot=_Tune.IdleThrottle/100 end end z.InputBegan:Connect(y)z.InputEnded:Connect(y)local function C(o,m)if o.UserInputState==Enum.UserInputState.Begin then _GBrake=1 else _GBrake=0 end end g.InputBegan:Connect(C)g.InputEnded:Connect(C)local function d(o,m)if o.UserInputState==Enum.UserInputState.Begin then _PBrake=not _PBrake elseif o.UserInputState==Enum.UserInputState.End then if car.DriveSeat.Velocity.Magnitude>5 then _PBrake=false end end end H.InputBegan:Connect(d)H.InputEnded:Connect(d)

	
	local Buttons = script.Parent:WaitForChild("Buttons")
	local Left = Buttons:WaitForChild("Left")
	local Right = Buttons:WaitForChild("Right")
	local Brake = Buttons:WaitForChild("Brake")
	local Gas = Buttons:WaitForChild("Gas")
    local Handbrake = Buttons:WaitForChild("PBrakeButton")
	
	if UserInputService.TouchEnabled then
	Buttons.Visible = true
	script.Parent:WaitForChild("Gauge").Visible = false
	end
	local function LeftTurn(Touch, GPE)
		if Touch.UserInputState == Enum.UserInputState.Begin then
				_GSteerT = -1
				_SteerL = true
			else
				if _SteerR then
					_GSteerT = 1
				else
					_GSteerT = 0
				end
				_SteerL = false
			end
	end
	Left.InputBegan:Connect(LeftTurn)
	Left.InputEnded:Connect(LeftTurn)
	--Left.InputChanged:Connect(LeftTurn)
	
	local function RightTurn(Touch, GPE)
		if Touch.UserInputState == Enum.UserInputState.Begin then
					_GSteerT = 1
					_SteerR = true
				else
					if _SteerL then
						_GSteerT = -1
					else
						_GSteerT = 0
					end
					_SteerR = false
				end
	end
	Right.InputBegan:Connect(RightTurn)
	Right.InputEnded:Connect(RightTurn)
	--Right.InputChanged:Connect(RightTurn)
	
	local function TouchThrottle(input, GPE)
		if input.UserInputState == Enum.UserInputState.Begin and _IsOn then
					_GThrot = 1
				else
					_GThrot = _Tune.IdleThrottle/100
				end
	end
	Gas.InputBegan:Connect(TouchThrottle)
	Gas.InputEnded:Connect(TouchThrottle)
	--Gas.InputChanged:Connect(TouchThrottle)
	
	local function TouchBrake(input, GPE)
		if input.UserInputState == Enum.UserInputState.Begin then
					_GBrake = 1
				else
					_GBrake = 0
				end
	end
	Brake.InputBegan:Connect(TouchBrake)
	Brake.InputEnded:Connect(TouchBrake)
	--Brake.InputChanged:Connect(TouchBrake)
	
	local function TouchHandbrake(input, GPE)
		if input.UserInputState == Enum.UserInputState.Begin then
					_PBrake = not _PBrake
				elseif input.UserInputState == Enum.UserInputState.End then
					if car.DriveSeat.Velocity.Magnitude>5 then
						_PBrake = false
					end
				end
	end
	Handbrake.InputBegan:Connect(TouchHandbrake)
	Handbrake.InputEnded:Connect(TouchHandbrake)