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

How do I make this ClickDetector script work?

Asked by 8 years ago

I'm trying to make a script that has a model become visible when you click a brick with a ClickDetector, then after 12 seconds it disappears. How do I make it so that I can click the block and it re-appears? I tried changing it a lot, but nothing worked.



visible = true script.Parent.ClickDetector.MouseClick:connect(function() if visible == true then for i,v in pairs(script.Parent.Parent["SampleName"]:GetChildren()) do v.Transparency = 0 -- 1 is for completely invisible v.CanCollide = true visible = true end end wait(12) --this is used to make it disappear again 12 seconds after the lines above were ran for i, v in pairs(script.Parent.Parent["SampleName"]:GetChildren()) do v.Transparency = 1 v.CanCollide = false visible = false end end) --trying to get it so that after i click the brick, i can come back, click it again, and it works. it doesn't no matter how much i try to change the script to work.
0
Nothing makes visible true again theCJarmy7 1293 — 8y
0
And why do you have it so that when Visible = true, it will then make it visible?? theCJarmy7 1293 — 8y
0
Half way through providing a very thorough answer, I discovered your question makes no sense. User#11440 120 — 8y
0
you are lacking knowledge of conditionals. I highly recommend referring to them, in the process of how they work. scottmike0 40 — 8y

Answer this question