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

Can't figure this out. Script will not work after certain value?

Asked by
bloxxyz 274 Moderation Voter
10 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

When I get the Transparency of 1, the script works well and repeats. When I get 0, no matter how many times I click the script fails to execute again. What do I do? Thank you.

math.randomseed(tick())
local sp = script.Parent
    local debounce = false
sp.ClickDetector.MouseClick:connect(function()
    print("pressed")
    if not debounce then
        debounce = true
sp.Transparency=math.random(0,1)
wait(2.5)
if sp.Transparency == 1 then
workspace.givecandy.Value = true
wait(5)
workspace.givecandy.Value = false
sp.Transparency = 0
debounce = false
elseif sp.Transparency == 0 then
wait(1)
print("not awake")
game.Workspace.grunt:Play()
game.Workspace.dialog2.d2.Transparency = 0
wait(3)
game.Workspace.dialog2.d2.Transparency = 1
end
    end
    end)

Answer this question