Hi, I’ve been trying to make a door with drag detectors, and I’ve ran into some issues.
If you look in the video posted the door works great, until you click.
Is there a way to detect a drag detector click, or somehow just not play the sounds when it’s clicked?
See the code below
local door = script.Parent.MainPart
local dragdetector = door.DragDetector
local dooropen = door.dooropen
local doorclose = door.doorclose
local targetOrientation = Vector3.new(0, -180, -90)
local threshold = 5
local doorOpened = false
dragdetector.DragStart:Connect(function()
local doorat = door.DoorAtt.WorldOrientation
local orientationDiff = (targetOrientation - doorat).Magnitude
if orientationDiff <= threshold then
dooropen:Play()
doorOpened = true
end
end)
dragdetector.DragEnd:Connect(function()
local doorat = door.DoorAtt.WorldOrientation
local orientationDiff = (targetOrientation - doorat).Magnitude
if orientationDiff <= threshold and doorOpened then
doorclose:Play()
doorOpened = false
end
end)