Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why Wont The Script Turn The Door Visible Again?

door = script.Parent.Parent.Door
 function onClicked()
      
    door.Transparency = 1
	door.CanCollide = false
 wait(2)
	door.Transparency = 0
	door.CanCollide = true
wait(3)
	script.Parent.ClickDetector.MouseClick:connect(onClicked)
	
	end

No Errors?

1 comment

0

On line 10 the event is being connected inside the function, when it shouldn't, unless you want to loop the function. Put it at the end of the code.

2 answers

✓ Accepted answer

try this, you call the function inside the function so in order for it to work the function must have be called before

door = script.Parent.Parent.Door
 function onClicked()

    door.Transparency = 1
    door.CanCollide = false
 wait(2)
    door.Transparency = 0
    door.CanCollide = true
wait(3)
    end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

EDIT: If you have the same problem make sure that the door or part is anchoired

3 comments

0

also tell me if it does not work

0

oh XD sorry man it didnt work because it wasnt achored sorry ill still accept it

0

ok, i just found out that too, i came here to edit my answer. The door was felling of the map, it was working but you couldn't see it

The line below needs to be placed below "end" because you need to call the function before.

script.Parent.ClickDetector.MouseClick:connect(onClicked)`

Fixed script below:

door = script.Parent.Parent.Door

function onClicked()
	door.Transparency = 1
	door.CanCollide = false
	wait(2)
	door.Transparency = 0
	door.CanCollide = true
	wait(3)
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

2 comments

0

it didnt work

0

where is the "door" placed?

This discussion is preserved as it was. New answers, comments, and votes are closed.