Hello there, I am pretty new to the world of Roblox scripting. I am trying to make a car chassis be drivable on mobile, by using a series on buttons. With the help of a friend, I got this script. It is inside the A-Chassis Tune script in the car, and there is a plugin for the buttons. My issue is that it is saying that basically anything that starts with an _ is unknown, and UserInputService is unknown. If someone is willing, I could invite them to a team create to help solve it.
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("Handbrake")
if UserInputService.TouchEnabled then
Buttons.Visible = true
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)