Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I set a speed limit on a-chassis?

So, I've been looking through the internet for solutions to this, but just can't find it.

I've tried this solution and this solution, but they didn't work. So, I made an abomination of a script (normal script) which is here:

local car = script.Parent
local velocity = car:WaitForChild("Values"):WaitForChild("Velocity")
car:WaitForChild("Values"):WaitForChild("Velocity").Changed:Connect(function()
	if (velocity > 59) then
		velocity = 59
	end
end)

I'm pretty sure I'm half way there, but something's missing.

If you could help me out it would be massively appreciated!

= ProvingTrottle

1 answer

First off, velocity will never change since it is pre defined, second, you need to reference the VALUE property of the velocity. (Assuming velocity is a intvalue or numbervalue)

local car = script.Parent
car:WaitForChild("Values"):WaitForChild("Velocity").Changed:Connect(function()
	local velocity = car:WaitForChild("Values"):WaitForChild("Velocity")
	if (velocity.Value >= 59) then
		velocity.Value = 59
	end
end)

1 comment

0

Didn't work

This discussion is preserved as it was. New answers, comments, and votes are closed.