This is my script, it always chooses "0", meaning the door's transparency will remain 0. I've tested it many times and it just doesn't seem to ever open the door. I understand random can sometimes repeat but, this is ridiculous. Any help? Do you see any errors I have skipped over in the last hour? Thank you.
sp=script.Parent sp.ClickDetector.MouseClick:connect(function() math.randomseed(tick()) sp.Transparency=math.random(0,1) wait(3) if sp.Transparency==1 then game.Workspace.givecandy.Value = true wait(5) if sp.Transparency==1 then sp.Transparency = 0 game.Workspace.givecandy.Value = false end else print("not awake") end end)
Again, no errors are shown in output, but if you see any I may have missed anyway please tell me. Or perhaps, I wrote the script wrong? Thank you again..
sp = script.Parent sp.ClickDetector.MouseClick:connect(function() math.randomseed(tick()) sp.Transparency = math.random(0, 1) wait(3) if sp.Transparency == 1 then game.Workspace.givecandy.Value = true wait(5) sp.Transparency = 0 game.Workspace.givecandy.Value = false else print("Not Awake") end end)
I'm pretty sure it's because you checked again if the Transparency equals 1. Since your script is still running after checking the first time that it's 1, you don't need to check again.
Try this.