Help with Tool Script

Hello fellow devs! I am making a tool that inserts a DragDetector into the player so that only the person that inserted it can drag the player around. Everything works except the part where is moves the player. I have no idea how to fix this. Here is my code:

local Run = game:GetService("RunService")
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()

Run.RenderStepped:Connect(function()
	local Target = Mouse.Target
	if Target and Target:FindFirstAncestorOfClass("Model") then
		local model = Target:FindFirstAncestorOfClass("Model")
		if model:FindFirstChild("Humanoid") then
			if model:FindFirstChild("Head"):FindFirstChild("DragDetector") then
				print("Can't insert")
				else
				local dragDetector = Instance.new("DragDetector")

				dragDetector.Parent = model:FindFirstChild("Head")
				dragDetector.DragStyle = Enum.DragDetectorDragStyle.TranslateViewPlane
			end
		end
	end
end)

So you have a client script adding DragDetectors to other players’ heads? There are countless reasons why this is difficult/shouldn’t be done. I’m not the most familiar with drag detectors and for a situation like this it might be best to create your own system. You could try setting the network ownership of the selected character’s HumanoidRootPart to the player with the tool.

1 Like

It’s a troll tool for my group.