Why does the TargetHumanoid not follow the Cuffer?
--//local script//--
local Cuff = script.Parent
local plr = game.Players.LocalPlayer
local char = plr.CharacterAdded:Wait()
local RS = game:GetService("ReplicatedStorage")
local CuffEvent = RS:FindFirstChild("Cuff")
local Handle = Cuff.Handle
local mouse = plr:GetMouse()
local isEquipped = false
local MyHumanoidRootPart = char:FindFirstChild("HumanoidRootPart")
local MyHumanoid = char:FindFirstChild("Humanoid")
local Range = 200
Cuff.Equipped:Connect(function()
isEquipped = true
end)
Cuff.Unequipped:Connect(function()
isEquipped = false
end)
mouse.Button1Down:Connect(function()
if isEquipped then
local ray = Ray.new(Handle.CFrame.p, (mouse.Hit.p - Handle.CFrame.p).unit * Range)
local part, position = workspace:FindPartOnRay(ray, plr.Character, false, true)
if part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid") then
local TargetHumanoid = part.Parent:FindFirstChild("Humanoid") or part.Parent.Parent:FindFirstChild("Humanoid")
local TargetHumanoidRootPart = TargetHumanoid.Parent:FindFirstChild("HumanoidRootPart")
CuffEvent:FireServer(TargetHumanoid, MyHumanoidRootPart)
end
end
end)
--//server script//--
local RS = game:GetService("ReplicatedStorage")
local CuffEvent = RS:FindFirstChild("Cuff")
CuffEvent.OnServerEvent:Connect(function(plr, TargetHumanoid, MyHumanoidRootPart)
TargetHumanoid:MoveTo(MyHumanoidRootPart.Position + Vector3.new(0, 10, 0))
end)