I wanna make a car, but I just wanna test the script right now. (since roblox practically made it impossible to create cars traditionally) But the script doesn't work, there are no errors, but nothing happens. I don't know if I'm supposed to use RemoteEvents?

--This is in a local script
local UIS = game:GetService("UserInputService")
local isKeyHeld = false
local bv = game.Workspace.Part.BodyVelocity

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.B then
        isKeyHeld = true
    end
    
    while isKeyHeld == true do
        wait()
        bv.Velocity = Vector3.new(10,0,0)
    end
end)

UIS.InputEnded:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.B then
        isKeyHeld = false
    end
    while isKeyHeld == false do
        wait()
        bv.Velocity = Vector3.new(0,0,0)
    end
end)
    

2 comments

0

What type of script is it? Where did you parent it? Does the Velocity actually change? Have you tried adding print statements?

0

It's a local script, it's a child of starterplayerscripts, i havent checked, and no