I'm basically trying to create an arrest system where I can detain someone, drag them over to the vehicle backdoor, and use a keybind to either A.) place them in the car for transport or B.) teleport them straight to the jail.
I already have the detain from a freemodel script, I'm just having trouble storing the detained persons UserId.
local RemoteEvent = script.Parent:WaitForChild("RemoteEvent") local TargetTorso = nil local Using = false function CheckForTargetTorso(part) if part.Parent:IsA'Model' and part.Parent:FindFirstChildOfClass'Humanoid' then local char = part.Parent local torso if char:FindFirstChild'Torso' then torso = char.Torso elseif char:FindFirstChild'UpperTorso' then torso = char.UpperTorso end return char, torso end end function CheckForTorso(player) local Char = player.Character if Char:FindFirstChild'Torso' then return Char.Torso else return Char.UpperTorso end end RemoteEvent.OnServerEvent:Connect(function(player, state, part) if state == 'Cuff' then local target = nil local playerTorso = nil target, TargetTorso = CheckForTargetTorso(part) playerTorso = CheckForTorso(player) if target then Using = true RemoteEvent:FireClient(player, 'Use') spawn(function() if Using then TargetTorso.Anchored = true end while Using and wait() do TargetTorso.CFrame = playerTorso.CFrame * CFrame.new( 0, 0, -5 ) end end) end elseif state == 'UnCuff'then Using = false TargetTorso.Anchored = false wait() end end)