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

Why are disabled scripts that become enabled not work?

Asked by 4 years ago

I have a script which i disable then enable to just cancel it. It's in starterpack and there's a local script that disables it then enables the script. I checked the explorer while i was playing the game. It did disable and enable like how i coded the local script. BUT when I play it even though its enabled it doesn't run.

In compacted form a local script that gets disabled then enabled doesn't work.

0
just put in a function then use return; no reason to do all that Fifkee 2017 — 4y
0
what do u mean? HappyTimIsHim 652 — 4y
0
fine i'll give u more info i have a push up script that activates when u click t, i have another script that you need to stop moving. Im trying to make it so u can only do one at a time but the pushup script doesn't work after i disable and enable HappyTimIsHim 652 — 4y
0
You don't have to disable, when you don't want the script to run anymore, write "return" Spjureeedd 385 — 4y

1 answer

Log in to vote
1
Answered by
haba_nero 386 Moderation Voter
4 years ago

Local scripts do stuff locally, which means you will have to use a normal script to enable/disable the script. The reason why you see it changing is because it is only changing locally. Thus, It will not work. I'd really just use functions if I were you. Example:

function sayhi()
    print("Hello!")
end
script.Parent.Touched:Connect(function()
    sayhi()
end

If you put this script inside a part and touch it, it should say the word Hi in the output. Hope this helps!

Ad

Answer this question