How to make a part disappear?

I am making a simple elevator, and am trying to make the door disappear and reappear.
Here is my script, nothing works, every single “Parent” has a W001 error, and no problems are in output.
Parent.door1.CanCollide = true
Parent.door1.Transparency = 0
wait (25)
Parent.door1.CanCollide = false
Parent.door1.Transparency = 1
wait (10)
Parent.door1.CanCollide = true
Parent.door1.Transparency = 0

When you type Parent it gets the hierarchical parent of the instance you call it on. Because you are calling Parent on nothing it returns an error. One way to use parent is:

Door.Parent.door1.Transparency = 0

You can read this to get more information on how to use parent: Instance | Documentation - Roblox Creator Hub

You can read more on Parent-Child Relationship here: Explorer Window | Documentation - Roblox Creator Hub

Here’s what you need:

while true do
    -- visible and can collide
    script.Parent.door1.CanCollide = true
    script.Parent.door1.Transparency = 0
    wait (25)

    -- invisible and cant collide
    script.Parent.door1.CanCollide = false
    script.Parent.door1.Transparency = 1
    wait (10)

Edit: Ha ha, I wrote Script instead of script, slight error fixed :slight_smile:

1 Like