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

How to stop this tool from running?

I have created a tool with a function, at the moment the function is set so it runs forever when I get the tool out of my backpack. How can I change the script below so it stops running when I put it back in the backpack? Below is where it runs the function.

script.Parent.Equipped:connect(function(eventMouse)
	while true do
		wait(0.01)
		GodPowers()
	end
end)

1 answer

✓ Accepted answer

You'd need to use the UnEquipped event. I'm not sure what's withing your GodPowers function, but within the function that includes the UnEquipped function, you'd change everything back.

3 comments

0

Hi Shawn thanks for the reply I know what you mean but I am new to coding and don't know how to do this, basically the GodPowers function changes the time of day when I move my mouse from the left side of the screen to the right, soon I will add arm movement into it but for now I just need to get god powers to stop running when I unequip the tool. So can you tell me exactly how to do this as I don

0

Hmm. If you're new to scripting, I suggest adding an ON script and an OFF script. Both would have while loops, and within the function that includes the Unequppied event,it would toggle the Disable property of both scripts.

0

Going to try this out!

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