This is my first post! I hope it will be useful to beginners
-
Making the door
Make a door in a workspace and name it ‘DoorPart’
Then anchor it -
Scripting the Door
I know the scripts look complex but it is very simple let’s follow me along!
First lets make a reference to the ‘DoorPart’ we’ve created earlier
local door = workspace:WaitForChild("DoorPart")
Now lets create a ClickDetector
local clickDetector = Instance.new("ClickDetector")
clickDetector.Parent = door
Now what is going on first we’ve created clickDetector and set it’s parent to the DoorPart. That’s it!
ok
But it doesn’t do anything so let’s make it functional !
first lets create a ‘Switch’ don’t worry it’s just a variable
local debounce = false
clickDetector.MouseClick:Connect(function()
if debounce == false then
door.CanCollide = false
door.Transparency = 0.5
debounce = true
elseif debounce == true then
door.CanCollide = true
door.Transparency = 0
debounce = false
end
end)
And that’s it! The door should be working now ! If not make sure you did everything like me in this guide