^
|
Up there is the scripts setup
My original scripts are as follows but I need to integrate a system where the ‘Criminals’ Team can be arrested and all teams can be frisked (And all tools removed). It is like the state view prison handcuff system, can attach video if neccessary.
‘Detain Create Dependencies’
if not game.ReplicatedStorage:FindFirstChild("DetainEvent") then
script.Parent.DetainEvent.Parent = game.ReplicatedStorage
end
if not game.ServerScriptService:FindFirstChild("DetainServer") then
script.Parent.DetainServer.Parent = game.ServerScriptService
end
wait()
script.Parent:Destroy()
‘Detain Server’
repeat wait() until game.ReplicatedStorage:FindFirstChild("DetainEvent")
local RemoteEvent = game.ReplicatedStorage.DetainEvent
local RunService = game:GetService("RunService")
local Enabled = {}
RemoteEvent.OnServerEvent:Connect(function(plr,purpose,mousetarget)
if plr ~= nil and purpose == "detain" then
if mousetarget.Parent:FindFirstChildOfClass("Humanoid") then
if not mousetarget.Parent:FindFirstChild("Detain") then
Enabled[plr.Name] = true
spawn(function()
repeat
mousetarget.Parent:FindFirstChildOfClass("Humanoid"):UnequipTools()
if mousetarget.Parent:FindFirstChild("UpperTorso") then
mousetarget.Parent.UpperTorso.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new( 0, 0, -5 )
else
mousetarget.Parent.Torso.CFrame = plr.Character.HumanoidRootPart.CFrame * CFrame.new( 0, 0, -5 )
end
RunService.Heartbeat:Wait()
until Enabled[plr.Name] == false
end)
end
else
Enabled[plr.Name] = false
RemoteEvent:FireClient(plr,"noOneToDetain")
end
elseif purpose == "undetain" then
Enabled[plr.Name] = false
end
end)
‘Detain Client’
repeat wait() until game.ReplicatedStorage:FindFirstChild("DetainEvent")
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Tool = script.Parent
local Enabled = false
local RemoteEvent = game.ReplicatedStorage.DetainEvent
Tool.Activated:Connect(function()
if Enabled == false then
if Mouse.Target then
Enabled = true
RemoteEvent:FireServer('detain', Mouse.Target)
end
else
Enabled = false
RemoteEvent:FireServer('undetain')
end
end)
Tool.Unequipped:Connect(function()
Enabled = false
RemoteEvent:FireServer('undetain')
end)
RemoteEvent.OnClientEvent:Connect(function(Purpose)
if Purpose == "noOneToDetain" then
Enabled = false
end
end)
Any help will be appreciated, Thanks.