local NullVector = Vector3.new(0,0,0)
local player = game.Players.LocalPlayer
local speed = 20
local rotend = true
local moveend = true
local pos = script.Parent.CarStat.Value
local rot = pos.Parent.BodyAngularVelocity
local uis = game:GetService("UserInputService")
uis.InputBegan:connect(function(input)
local keycode = input.KeyCode
if keycode == Enum.KeyCode.W then
moveend = true
moveend = false
pos.Velocity = pos.Parent.CFrame.lookVector*speed
repeat wait() until moveend == true
pos.Velocity = NullVector
end
if keycode == Enum.KeyCode.S then
moveend = true
moveend = false
pos.Velocity = (pos.Parent.CFrame.lookVector*-1)*speed
repeat wait() until moveend == true
pos.Velocity = NullVector
end
if keycode == Enum.KeyCode.A then
rotend = true
rotend = false
rot.AngularVelocity = Vector3.new(0,-10,0)
repeat wait() until rotend == true
rot.AngularVelocity = NullVector
end
if keycode == Enum.KeyCode.D then
rotend = true
rotend = false
rot.AngularVelocity = Vector3.new(0,10,0)
repeat wait() until rotend == true
rot.AngularVelocity = NullVector
end
end)
uis.InputEnded:connect(function(input)
local key = input.KeyCode
if key == Enum.KeyCode.W or key == Enum.KeyCode.S then
moveend = true
end
if key == Enum.KeyCode.A or key == Enum.KeyCode.D then
rotend = true
end
end)
I already made the script that turns the car on when you sit in it. This localscript is put into the player that is sitting in the car. That works just fine but the Localscript (above) is not working nor is it raising an error to help me debug the problem. I need someone else who can easily spot errors to help me. I have no clue what's wrong.

1 comment
This answer didn't tell me what the problem was but it did help me find it.