Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I disable the backpack when arrested with my handcuffs?

Basically, i want to prevent the person who is in handcuffs from using the handcuff that the person who arrested him, due to the fact that they can arrest each other and they cannot move at all. i only want one person to be able to use the handcuff.

 function DETAIN(char)
if char:findFirstChild("Humanoid") then
	char.Humanoid.PlatformStand=true
		char.Humanoid.WalkSpeed=0
		char.Humanoid.
end
WELD = Instance.new("Weld",char.Torso)
WELD.Part0 = char.Torso
WELD.Part1 = ply.Character.Torso
WELD.C1 = WELD.C1 * CFrame.new(0,.05,-2)
char.Torso["Left Shoulder"].Part1 = nil
char.Torso["Right Shoulder"].Part1 = nil
if char:findFirstChild("Left Arm") then
	LWELD = Instance.new("Weld",char.Torso)
	LWELD.Part0 = char.Torso
	LWELD.Part1 = char["Left Arm"]
	LWELD.C1 = CFrame.new(0.5, -0.30, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, math.rad(-45))
end
if char:findFirstChild("Right Arm") then
	RWELD = Instance.new("Weld",char.Torso)
	RWELD.Part0 = char.Torso
	RWELD.Part1 = char["Right Arm"]
	RWELD.C1 = CFrame.new(-0.5, -0.30, -0.5) * CFrame.fromEulerAnglesXYZ(math.rad(40), 0, math.rad(45))
end
end

function RELEASE(char)
if char:findFirstChild("Humanoid") then
	char.Humanoid.PlatformStand=false
	char.Humanoid.WalkSpeed=16
end
if RWELD~=nil then char.Torso["Right Shoulder"].Part1 = char:findFirstChild("Right Arm"); RWELD:Destroy(); end
if LWELD~=nil then char.Torso["Left Shoulder"].Part1 = char:findFirstChild("Left Arm"); LWELD:Destroy(); end
if WELD~=nil then WELD:Destroy() end
end

function PRISON(char)
local ArrestGUI = script.reason:Clone()
ArrestGUI.Parent = script.Police.Value.PlayerGui
ArrestGUI.ReasonFrame.LocalScript.Disabled = false
funlol = script.reas.OnServerEvent:connect(function(plr,rea)
if char:findFirstChild("Humanoid") then
	char.Humanoid.PlatformStand=false
	char.Humanoid.WalkSpeed=16
end
if WELD~=nil then WELD:Destroy() end
ArrestReason[2] = "*" ..script.Police.Value.Name .. " *\n"
ArrestReason[4] = "" ..rea .."\n"
post(char.Name,ArrestReason[1],ArrestReason[2],ArrestReason[3],ArrestReason[4])
game.Players:GetPlayerFromCharacter(script.Parent).TeamColor=BrickColor.new("Really black");
game.Players:GetPlayerFromCharacter(script.Parent):LoadCharacter()
funlol:disconnect()
end)

end

script.CMD.OnServerEvent:connect(function(plr,arg)
if arg=="Prison" then PRISON(script.Parent)
elseif arg=="Release" then RELEASE(script.Parent) return end
end)

DETAIN(script.Parent)

1 answer

You have to use :FireClient(player) to a RemoteEvent that replicates to the local script, in where the local script has OnClientEvent connected to a function that disables the backpack CoreGui.

game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack,false)

also, don't forget to parent the handcuffed user's handcuff to the Backpack before disabling their backpack so they can't use it.

1 comment

0

Sorry but that's about it. I didn't learn OnClientEvent. Could you help me in team create?

This discussion is preserved as it was. New answers, comments, and votes are closed.