First thing first, insert a Part in the Workspace then rename it Door and thats gonna be the door. Make sure that Anchor and CanCollide is on. Insert a Script and a ClickDetector inside the Part. Then type this in the script:
01 | local Door = script.Parent |
03 | local ClickDetector = script.Parent.ClickDetector |
05 | local HoverSelectionBox = Instance.new( "SelectionBox" , Door) |
06 | HoverSelectionBox.Visible = false |
09 | local ClickDoorFunction = function () |
10 | Door.CanCollide = not Door.CanCollide |
12 | Door.Transparency = not Door.CanCollide and 0.5 or 0 |
16 | local DoorMouseOver = function () |
17 | HoverSelectionBox.Visible = true |
21 | local DoorMouseLeave = function () |
22 | HoverSelectionBox.Visible = false |
26 | ClickDetector.MouseClick:Connect(ClickDoorFunction) |
28 | ClickDetector.MouseHoverEnter:Connect(DoorMouseHover) |
30 | ClickDetector.MouseHoverLeave:Connect(DoorMouseLeave) |
33 | HoverSelectionBox.Adornee = Door |
And now your done! Make sure to test it if it works!
If it did not work please comment/reply