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 make button activated spinning?

I've been using a script to make an object spin: while true do script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0,0,-0.1) wait() end

I've been using this and I'm wondering is there anyway to make it button activated? For example I press a button, it starts spinning; if I press it again, it stops.

1 answer

Yes!

You can use a boolean to toggle the spinning.

Here's a quick example:

local boolean = true

script.Parent.MouseClick:connect(function()
	if boolean == true then
		-- do code
		boolean = false
	else
		-- do code
		boolean  = true
	end
end

1 comment

0

Is there anyway to do this with the script i used?

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