I’m trying to make a racing game, and the first vehicle I’m making is a rideable shopping car. Though, the script doesn’t propel me forward and also for some reason the cart just kind of… floats?
Code:
local seat = script.Parent
local shoppingCart = seat.Parent
local cart = shoppingCart:WaitForChild("Cart")
local linearVelocity = cart.LinearVelocity
seat:GetPropertyChangedSignal("Throttle"):Connect(function(value)
if value == 1 then
linearVelocity.VectorVelocity.Z = Vector3.new(0, 0, 5)
elseif value == -1 then
linearVelocity.VectorVelocity.Z = Vector3.new(0, 0, -5)
end
end)
They are all zero, although I lowered the max force to 75 from inf+ and it ended up fixing it.
Though, I still cannot move the vehicle. Nothing’s getting printed into the output.
local seat = script.Parent
local shoppingCart = seat.Parent
local cart = shoppingCart:WaitForChild("Cart")
local linearVelocity = cart.LinearVelocity
seat:GetPropertyChangedSignal("Throttle"):Connect(function(value)
if value == 1 then
linearVelocity.VectorVelocity = Vector3.new(0, 0, 5)
print(1)
elseif value == -1 then
linearVelocity.VectorVelocity = Vector3.new(0, 0, -5)
print(-1)
end
end)