So I made a door and followed a tutorial on how to keybind it, and everything was going well until i opened the door, it was fine until I attempted to close it, it would not close, I tried redoing the motor6d, it still wouldn’t work, i checked the script and there were no errors in analysis or output, this is the script that allows it to open and close.
door = the door
AB = motor6d
i legitimately have no idea what was going wrong
(there is another script but that is what fires the event)
local Door = script.Parent.Door
script.Parent.ToggleDoor.OnServerEvent:Connect(function()
if Door.Transparency == 0 then
script.Parent.AB.Open.DesiredAngle = -1.6
Door.CanCollide = false
else
Door.Transparency = 0
script.Parent.AB.Open.DesiredAngle = 0
Door.CanCollide = true
end
end)
I only added the transparency lines because it wouldn’t work without them, the door isn’t one of those doors where when you click it, it turns invisible and another turns visible. its a motor6d door that when you press e in front of it, it makes the motor6d desired angle -1.6
local db = false
local Door = script.Parent.Door
script.Parent.ToggleDoor.OnServerEvent:Connect(function()
if db == false then
db = true
script.Parent.AB.Open.DesiredAngle = -1.6
Door.CanCollide = false
else
db = false
Door.Transparency = 0
script.Parent.AB.Open.DesiredAngle = 0
Door.CanCollide = true
end
end)