How do I make a arrest gui show on escape?

Thanks for you help! I will hopefully get the arresting working.

There is a issue tho the gui doesn’t even clone due to a error. Error: attempt a nil with character. How do I fix it? I still haven’t fixed it.

What’s your code?

1 Like

local player = game.Players.LocalPlayer
local Character = player.Character

local Teams = game:GetService(“Teams”)

local criminalTeam = Teams.Criminal – Change to your team
local gui = game.ServerStorage.Arrected – Change to your GUI

local connections = {}

function CriminalCharacterAdded(character)
local upperTorso = character:WaitForChild(“UpperTorso”)

local clonedGui = gui:Clone()
clonedGui.Parent = upperTorso

end

criminalTeam.PlayerAdded:Connect(function(player)
local character = player.Character or player.CharacterAdded:Wait()

CriminalCharacterAdded(character)
connections[player.Name] = player.CharacterAdded:Connect(function(playerCharacter)
	CriminalCharacterAdded(playerCharacter)
end)

end)

criminalTeam.PlayerRemoved:Connect(function(player)
if connections[player.Name] ~= nil then
connections[player.Name]:Disconnect()
end
end)

On which line does that happen?

1 Like

At line 2 the error happens. I think.

Edit: I removed line 2 because it is not needed. The function already connects the character.

Use this:

Ok so I made a system that works well for the police team. so basily it is bursting system for the bank when the police walks in vault all the criminals get bursted. but there’s a issue tho. the player can move when they got bursted before being sent back to jail. Can you give a example on how to put cuffs so the crimnals can’t move?

Just anchor player’s HumanoidRootPart to prevent the player from moving.

1 Like

Your idea does work but the player will not look like they got arrested tho. I want a way to make it like that.

Use welds.

local cuff1 = game.Lighting.Cuff1
local cuff2 = game.Lighting.Cuff2
local weld = Instance.new("Weld")
local weld2 = Instance.new("Weld")
cuff1.Parent = workspace.PlayerName
cuff2.Parent = workspace.PlayerName
weld.Part0 = cuff1
weld.Part1 = workspace.PlayerName.RightHand
weld2.Part0 = cuff2
weld2.Part1 = workspace.PlayerName.LeftHand

weld.Parent = workspace.PlayerName
weld2.Parent = workspace.PlayerName

This is just an e.g, when you set the welds part0, part1 it will snap onto the hands. Then you can just play an animation. I think the rest is going to be your job to make, as you really provided no code to work with or attempts at this.

Also to make an arrest gui show on escape you simply clone the gui into playergui.

local gui = script.GUI:Clone()
gui.Parent = game.Players.LocalPlayer.PlayerGui

So is this for when the player gets arrested the cuffs are on them or for the handcuffs that the police is holding? Also I was adding a feature for the police team for bursting the criminals that is already done just no cuffs get put on them because I didn’t code that.

Edit: want to see the code?

It can be for both, the rest is up to you. But I suggest the police would have a tool instead of welded cuffs.

1 Like