Curtain = game.Workspace.Curtain
function onClicked()
Curtain.Transparency.new = 0.1 Curtain.Transparency.new = 0.2 Curtain.Transparency.new = 0.3 Curtain.Transparency.new = 0.4 Curtain.Transparency.new = 0.5 Curtain.Transparency.new = 0.6 Curtain.Transparency.new = 0.7 Curtain.Transparency.new = 0.8 Curtain.Transparency.new = 0.9 Curtain.Transparency.new = 1 wait(3) Curtain.Transparency.new = 0.9 Curtain.Transparency.new = 0.8 Curtain.Transparency.new = 0.7 Curtain.Transparency.new = 0.6 Curtain.Transparency.new = 0.5 Curtain.Transparency.new = 0.4 Curtain.Transparency.new = 0.3 Curtain.Transparency.new = 0.2 Curtain.Transparency.new = 0.1 Curtain.Transparency.new = 0
end
Curtain.ClickDetector.MouseClick:connect()
I'm building the new Roblox Got Talent place for this winters show and I'm having problems with making the curtain fade away and after 3 seconds I want it to fade back in again. What am I doing wrong?
the end should be
Curtain.ClickDetector.MouseClick:connect(OnClicked)
For the sake of efficiency, you could use a "for" loop instead:
Curtain = game.Workspace.Curtain function onClicked() for i = 1,10 do Curtain.Transparency = Curtain.Transparency + .1 wait(.25) -- This could be too fast. end Curtain.Transparency = 1 --Makes sure it is invisible. wait(3) for i = 1,10 do Curtain.Transparency = Curtain.Transparency - .1 wait(.25) -- This could be too fast. end Curtain.Transparency = 0 --Makes sure it is visible. end Curtain.ClickDetector.MouseClick:connect(onClicked)
Plus, your code doesn't have any wait times in between each line, so it's going to all run at the same time (the parts before "wait(3)" and after), meaning when it is clicked, the Curtain will be invisible for 3 seconds, then become visible. It won't undergo transition.