hey developers, ive been working on a detain tool for a client recently, but i just can’t figure out how to make the detained player follow behind the ‘detainer’. ive tried eveything from welding to setting the detained humanoidrootpart to 5 studs behind the detainer, it just doesnt work.
im honestly not sure what to do, so i came here to a trusty development source, here are my scripts.
hierarchy:
local script:
local tool = script.Parent
local plr = game.Players.LocalPlayer
local event = script.Parent:WaitForChild('Lock')
tool.Equipped:Connect(function(mouse)
mouse.Button1Down:Connect(function()
if mouse.Target then
event:FireServer(mouse.Target)
end
end)
end)
server script:
local event = script.Parent:WaitForChild('Lock')
event.OnServerEvent:Connect(function(plr, Target)
if Target.Name == 'HumanoidRootPart' then
--dont know what to do next.
--[[
a:
local newtar = Target
local char = plr.Character
local HRP = char.HumanoidRootPart
local w = Instance.new('Weld', newtar)
w.Part0 = w.Parent
w.Part1 = HRP
b:
set the detained hrp 5 studs behind the detainer
]]
end
end)
any help, advice or suggestions would be highly appreciated
thanks in advance