So I’m working on a script to make an advanced car in Roblox (without a vehicle seat). When the player presses W the car will accelerate (“wValue” determines whether the W key is pressed or not)
The issue is the the car doesn’t even budge when I play the game and hold W. Any recommendations to fix this script?
local wValue = nil
local maxSpeed = 50
local accelerationRate = 2
while wait(0.1) do
wValue = game.Workspace.valueFolder.wValue.Value
if wValue == true then
if game.Workspace.car.LeftWheel.AngularVelocity < 1 then
game.Workspace.car.LeftWheel.AngularVelocity = 2
game.Workspace.car.LeftWheel1.AngularVelocity = 2
game.Workspace.car.RightWheel.AngularVelocity = -2
game.Workspace.car.RightWheel1.AngularVelocity = -2
end
game.Workspace.car.LeftWheel.AngularVelocity = tonumber(game.Workspace.car.LeftWheel.AngularVelocity)*accelerationRate
game.Workspace.car.LeftWheel1.AngularVelocity = tonumber(game.Workspace.car.LeftWheel1.AngularVelocity)*accelerationRate
game.Workspace.car.RightWheel.AngularVelocity = -(math.abs(tonumber(game.Workspace.car.RightWheel.AngularVelocity)*accelerationRate))
game.Workspace.car.RightWheel1.AngularVelocity = -(math.abs(tonumber(game.Workspace.car.RightWheel1.AngularVelocity)*accelerationRate))
end
end