DragDetector.DragContinue not firing

hello devs!
i have a problem with dragdetectors
this is my script:

	dragDetector.DragContinue:Connect(function(player:Player, cursorRay:Ray)
		print("not firing ):")
	end)

but sadly the dragcontin ue doesn’t work, the dragstart, dragend, etc… do fire, but the dragcontinue doesn’t.

by the way these are my drag detector properties (when i change to type from scriptable it works but I need it to be scriptable!!!)

	local dragDetector = Instance.new("DragDetector")
	dragDetector.DragStyle = Enum.DragDetectorDragStyle.Scriptable
	dragDetector.ResponseStyle = Enum.DragDetectorResponseStyle.Custom
	dragDetector.Enabled = true
	dragDetector.RunLocally = false
	dragDetector.PermissionPolicy = Enum.DragDetectorPermissionPolicy.Everybody
	dragDetector.Responsiveness = 100
	dragDetector.Parent = item

Hmm, and you are setting the SetDragStyleFunction to be some function? I’m guessing since you need it to be scriptable.
Just wondering if when it’s set to scriptable if the DragContinue event is tied to the execution of the DragStyleFunction.

Hello everyone!
I fixed it with setting the DragDetectorDragStyle from Scriptable to TranslateLine!

Roblox has disabled the dragDetector.DragContinue on the Scriptable type…

Hi @vojtasuper2 ,

The reason your dragContinue callback is not being invoked is because you set the dragStyle to scriptable but you didn’t provide a scripting function to invoke.
So the dragdetector knows nothing will ever change so why bother?
If you register any function at all, you’ll dragContinue will get called.

Here are 3 examples:
[1] register a function that does nothing. In this case, you return nil and nothing moves, but you still get your dragContinue call

dragDetector:SetDragStyleFunction(function()
	return nil
end)

[2] register a simple counter thst slides the object every time you nudge the mouse:
This is silly but you’ll see something move:

local count = 1
script.Parent.DragDetector:SetDragStyleFunction(function()
	count = count + 1
	return CFrame.new(Vector3.new(count,0,0))
end)

[3] register a ‘follow-the-cursor’ dragStyleFunction. that shoots a ray and sticks the object wherever you pick. It’s like select mode in roblox studio.
I won’t post the text here, but go to the tutorial page and search for dragStyleFunction. There’s a code snippet you can copy/paste to try it out:

2 Likes

Thank you for sharing that information with me!
I didn’t know that!
Even though I already got it working with a different approach, thanks!