So, I tried making a train throttle system for my new train game. I'm trying to make the train keep at the speed that you set it after you stopped hitting "W" or "S". Basically, no automatic deceleration.

I tried this, but the train just flies away!

(It's a server script placed inside the vehicleseat)

while true do
	game:GetService("RunService").Heartbeat:wait()
	local magnitude = script.Parent.Velocity
	if script.Parent.Throttle == 0 then
		script.Parent.Velocity = magnitude
	end
end

Any help would be appreciated!

1 comment

0

You can't use RunService in a server script