I want to make a door open from a click and go transparent, I have that part covered. Though I need help on making it close 1 or 2 seconds after the click. Please help... Below is my code.
Door = script.Parent
function onClicked() Door.Transparency=.6 Door.CanCollide=false end
Door.ClickDetector.MouseClick:connect(onClicked)
if Door.ClickDetector.MouseClick:connect(onClicked) then wait(2) Door.Transparency=0 Door.CanCollide=true end
I personally can't read random code. Use a code block. You've been here long enough, and I know you've been told this before.
Here's your code in a code block,
Door = script.Parent function onClicked() Door.Transparency=.6 Door.CanCollide=false end Door.ClickDetector.MouseClick:connect(onClicked) if Door.ClickDetector.MouseClick:connect(onClicked) then wait(2) Door.Transparency=0 Door.CanCollide=true end
It looks to me like you found a free model, tried to edit it, failed, and came here. Maybe not though. I'm just telling you what it looks like.
Just move the code in the conditional statement into the function "onClicked"
local Door = script.Parent function onClicked() Door.Transparency=.6 Door.CanCollide=false wait(2) Door.Transparency=0 Door.CanCollide=true end Door.ClickDetector.MouseClick:connect(onClicked)
Good Luck