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

How do I make something move, By hitting a button?

I would Hopefully Like to make something move By itself! Kinda Like a Rocking ship at a Carnival, How would I make something move by the hit of the button?

1 answer

✓ Accepted answer

Well, I would recommend this. The script would be inside the part in which needs to be touched

local enabled = false


function onTouched()
if enabled = false then
wait()
enabled = true
wait(1)
else 
enabled = false
wait(1)
end
end

While true do
wait()
if enabled = true then
-- You did not really specify what you want. So make a line here, of what you want to happen once --enabled = true (It becomes true once touched, and when touched again, it turns off)
end
end

script.Parent.Touched:connect(onTouched)

So how this works is really simple. I didn't test in studio, I just made this, so it might have error. When the part (Script's Parent) is touched, then the enabled is turned on (And touched again turns it off) - Then you have a while loop that does something as long as enabled is true. Just make sure to edit that line, since you did not explain what you actually needed. I hope I was of some help.

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