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)