num = 0 button = script.Parent engine = button.Parent.Parent.Engine.BodyVelocity

function normalspeed()

button.BrickColor = BrickColor.new(37) engine.velocity = Vector3.new(0,0,60) end

function lowspeed() button.BrickColor = BrickColor.new(24) engine.velocity = Vector3.new(0,0,35) end

function brake() button.BrickColor = BrickColor.new(21) engine.velocity = Vector3.new(0,0,0) end

button.ClickDetector.MouseClick:connect(function() num = num + 1 if num == 1 then normalspeed() elseif num == 2 then lowspeed() elseif num == 3 then brake() num = 0 end end)

I just started experimenting with body movers today because I am building a train. My goal is to make script.Parent.Parent.Parent move at different speeds by changing BodyVelocity.velocity when script.Parent is clicked. The button changes color, but the train does not move in any direction at all. It is not anchored or anything, and it is lined up on the axis correctly, but there is still a problem. The output returns no errors, by the way. Could anyone solve my problem? Thanks!

3 comments

0

Please edit your post to make the Lua code formatting right

0

I keep trying to edit it, but the format won't show when I view the saved post.

0

There should be one bar of tildes (~~~~~) above the code, and one bar below (after).