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
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?

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

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

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.

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)
0
it didnt work JordanTheDev_Team 33 — 4y
0
where is the "door" placed? KripticalYT 100 — 4y

Answer this question