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

This Script Wont Work For Me, Help?

Asked by 9 years ago

This Function Ontouch Script Wont Work For Me, But It Will Work For My Friend, orangylemon. Help?

function OnTouched() game.Workspace.Sound:Play() script.Disabled = true wait(87) script.Disabled = false end if script.Parent.Touched:connect(OnTouched)

0
Thank You 1waffle1, i can now run my script, thank you c: slendermanpowerman 5 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

A disabled script cannot enable itself. What you seem to be trying to do is this, though:

local busy=false
script.Parent.Touched:connect(function()
    if busy then return end
    busy=true
    workspace.Sound:Play()
    wait(87)
    busy=false
end)

This creates a variable busy and cancels if it's true, then sets it back to false when it's done.

Ad

Answer this question