local Y=script.Parent:WaitForChild("\066\117\116\116\111\110\115")local w=Y:WaitForChild("\076\101\102\116")local s=Y:WaitForChild("\082\105\103\104\116")local M=Y:WaitForChild("\066\114\097\107\101")local x=Y:WaitForChild("\071\097\115")local k=Y:WaitForChild("\080\066\114\097\107\101\066\117\116\116\111\110")if UserInputService.TouchEnabled then Y.Visible=true;(script.Parent:WaitForChild("\071\097\117\103\101")).Visible=false end local function A(Y,w)if Y.UserInputState==Enum.UserInputState.Begin then _GSteerT=-1 _SteerL=true else if _SteerR then _GSteerT=1 else _GSteerT=0 end _SteerL=false end end w.InputBegan:Connect(A)w.InputEnded:Connect(A)local function f(Y,w)if Y.UserInputState==Enum.UserInputState.Begin then _GSteerT=1 _SteerR=true else if _SteerL then _GSteerT=-1 else _GSteerT=0 end _SteerR=false end end s.InputBegan:Connect(f)s.InputEnded:Connect(f)local function p(Y,w)if Y.UserInputState==Enum.UserInputState.Begin and _IsOn then _GThrot=1 else _GThrot=_Tune.IdleThrottle/100 end end x.InputBegan:Connect(p)x.InputEnded:Connect(p)local function i(Y,w)if Y.UserInputState==Enum.UserInputState.Begin then _GBrake=1 else _GBrake=0 end end M.InputBegan:Connect(i)M.InputEnded:Connect(i)local function c(Y,w)if Y.UserInputState==Enum.UserInputState.Begin then _PBrake=not _PBrake elseif Y.UserInputState==Enum.UserInputState.End then if car.DriveSeat.Velocity.Magnitude>5 then _PBrake=false end end end k.InputBegan:Connect(c)k.InputEnded:Connect(c)
-- [[MASTER'S MOBILE SUPPORT]]

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)
