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

click to spin a brick and stop when clicked again?

i wonder how to make a brick that spin forever when another brick(button) is clicked and stop when button is clicked again .HOW?

3 comments

0

Have you even made an attempt at doing this? This is something very easy.

0

It's pretty easy tho

0

i att but dont work , also im new to scripit tried my best , plz help

1 answer

✓ Accepted answer
local On = false
local Spinbrick = game.Workspace:FindFirstChild("SpinBrick")--Name of the brick that spins
script.Parent.MouseClick:Connect(function()
	if On == false then
		On = true
		While On = true do
			for i=-180,180,1 do
				Spinbrick.Rotation = Vector3.new(i,0,0)
				wait(0.05)
			end
		end
	else
		On = false
	end
end

Put this script inside the click detector inside the brick. Remember to use the clickdetector! I hope this works!

1 comment

0

while On == true do; you may also want a break in the for loop. 

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