How to do script which will open door if you will touch "part"

How to do script which will open door if you will touch “part”

I tried to write this script, but it didnt work

You can find many great tutorials on the internet but assuming your door is one part you can use the touched event to open the door:

-- assuming the script is inside the part that will be touched and your door is named "Door" in the workspace
local TouchPart = script.Parent
local Door = game.Workspace.Door

TouchPart.Touched:Connect(function(collidedPart)
	for i = 1, 0, 0.1 do --This will decrease the door's transparency by 0.1 10 times
		wait(0.1)
		Door.Transparency = i
	end
	Door.CanCollide = false -- turn of cancollide so the door is gone
end)

Make sure you have anchored the door and that it is one part. If you want more of a realistic door i would suggest watching some tutorials on it. Next time please ask for help on how to fix it instead of asking someone to do it completely.

1 Like

Thank you so much Jacqueline. You helped me.