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

Why Wont The Script Turn The Door Visible Again?

Asked by 4 years ago
Edited 4 years ago
01door = script.Parent.Parent.Door
02 function onClicked()
03 
04    door.Transparency = 1
05    door.CanCollide = false
06 wait(2)
07    door.Transparency = 0
08    door.CanCollide = true
09wait(3)
10    script.Parent.ClickDetector.MouseClick:connect(onClicked)
11 
12    end

No Errors?

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. Dfzoz 489 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

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

01door = script.Parent.Parent.Door
02 function onClicked()
03 
04    door.Transparency = 1
05    door.CanCollide = false
06 wait(2)
07    door.Transparency = 0
08    door.CanCollide = true
09wait(3)
10    end
11script.Parent.ClickDetector.MouseClick:connect(onClicked)

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

0
also tell me if it does not work dionsyran2 66 — 4y
0
oh XD sorry man it didnt work because it wasnt achored sorry ill still accept it JordanTheDev_Team 33 — 4y
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 dionsyran2 66 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

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

Fixed script below:

01door = script.Parent.Parent.Door
02 
03function onClicked()
04    door.Transparency = 1
05    door.CanCollide = false
06    wait(2)
07    door.Transparency = 0
08    door.CanCollide = true
09    wait(3)
10end
11 
12script.Parent.ClickDetector.MouseClick:connect(onClicked)
0
it didnt work JordanTheDev_Team 33 — 4y
0
where is the "door" placed? KripticalYT 100 — 4y

Answer this question