Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to stop this tool from running?

Asked by 10 years ago

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

Log in to vote
0
Answered by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

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.

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 CrystalCoder 20 — 10y
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. Shawnyg 4330 — 10y
0
Going to try this out! CrystalCoder 20 — 10y
Ad

Answer this question