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)

3 comments
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
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.
Going to try this out!