How to fix drag detector replication from client to server?

just realized
hacky solution is to use a unreliable remote event to replicate it to other clients

I want the drag detector to run smoothly on the client and replicate to the server every time drag continued is called? it only replicates after the drag has ended.

so far i have it a server event to set the network owner to the player so it doesn’t lag on the client

also how do i disconnect the SetDragStyleFunction

drag:SetDragStyleFunction(function(cursorRay : Ray) : CFrame
	return blockcast(cursorRay, drag, pizza) or pizza.CFrame
end)

i tried the following

pizza["DragDetector"].SetDragStyleFunction:Disconnect()

im able to disconnect the drag start function

pizzas[pizza].Start = drag.DragStart:Connect(function(player : Player)
	event:FireServer(pizza)
end)
local function removeDrag(pizza)
	if not pizzas[pizza] then return end
	pizzas[pizza].Start:Disconnect()
	pizza:FindFirstChildWhichIsA("DragDetector"):Destroy()
	pizzas[pizza] = nil
end

or does it disconnect when i destroy the object?

1 Like