How to make drag detector to run locally and update to server?

so far i got this however it updates position for the client as well when updating it for the server

i set lag delay so you can see the difference of client and server


its running on a local script and the drag detector’s run locally option is checked

--client
drag.DragContinue:Connect(function()
	event:FireServer(object.CFrame)
end)
--server
event.OnServerEvent:Connect(function(player, cframe)
	object.CFrame = cframe
end)
2 Likes

I haven’t worked with DragDetectors, but you could theoretically:

Set the Network Owner of the part you’re dragging to the “Player” dragging the part (which should basically replicate what ur doing in client to server, like filtering enabled never existed.)

Then once you’re done with dragging, just set the network owner back to server (or nil)

If you’re dealing with an anchored part, un-anchor it and add something that acts like a fake anchor (like BodyVelocity set to Vector3.zero) before setting the network owner to the player

part.Anchored = false -- if the part is Anchored
local fake_Anchor = Instance.new("BodyVelocity",part)
part:SetNetworkOwner(player)

All done on the server when you :FireServer() both DragBegan and DragEnded (i think thats what they’re called)

1 Like

already tried set owner, it does nothing while dragging

Could I see what you tried doing?

i sent a remote event of the position as a parameter
for drag end function, it does work sorta?
but it sometimes teleports back to previous position

Can’t you just send the current position from the client to the server to fix that issue? Again, could I see what you tried doing with the Network Owner implementation?

i set it here, but i dunno how it works

also you see from the video, i did sent the position of the object from the client to the server but it also replicates the position to the client as you can see from the video

Were there any errors that popped up?

nope

type or paste code here

i got it to work by setting the set network owner on the drag start function
object:SetNetworkOwner(player)

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