Changing DragDetector PermissionPolicy does not reset active dragging

While dragging a part with DragDetector in it, if you were to change the permission policy of the DragDetector from Everybody to Nobody, it wouldn’t affect the active drag, which is a quite serious issue.

Expected behavior

It stops any of the active dragging on the DragDetector.

This is by design.
The permissionPolicy is only checked when the drag is initiated.
If you want to stop the drag while it is in progress, you may register an event handler for dragDetector.dragContinue; and during that method you may set enabled to false and then back to true. This will stop the current drag.

Here is an example script you can use. Place it as a sibling to your DragDetector to try it out:

local dd = script.Parent.DragDetector

local startTime = 0
local didDisable = false
dd.DragStart:Connect(function()
	print("dragSTart")
	startTime = os.time()
	didDisable = false
end)

dd.DragContinue:Connect(function()
	if os.time() - startTime > 2 and didDisable == false then
		print("DISABLING DRAGDETECTOR")
		dd.Enabled = false
		dd.Enabled = true
		didDisable = true
	end
end)
2 Likes

ah ok, thank you for the example!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.