Hello there, I was wondering if there was a way to add 2 things, like an anti inventory to the detain system. So the user in cuffs can’t see his inventory anymore. And When you cuff a person it plays an audio and when you uncuff them it plays a different audio.
Noah
2
Yes, there is a way to do this.
Thanks for getting back so quickly! So to set things straight, my knowledge on scripting is pretty bad when it comes to things like this. I was wondering if you could tell me how to edit the script so it ads these features. Thanks again!
Noah
4
I can’t make the script for you as this is to help you with broken scripts, not to make them, but I can point you in the correct direction:
- Detect when the user is cuffed and hide clear their inventory, you can hide the backpack:
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
- Also you can detect when the cuff and uncuff is triggered and play the noise using sounds and
sound:play.
Once you get an example script we would be happy to help you fix it and get it working exactly how you want.
Thank you so much for the help! I’ll get back to you once I’ve made some progress.
1 Like
So this is the script I have currently, only problem with it is that when it disables the inventory it doesn’t bring it back when the player gets uncuffed.
local StarterGui = game:GetService('StarterGui')
local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local AntiInventory = ReplicatedStorage:WaitForChild("AntiInventory")
AntiInventory.OnClientEvent:Connect(function(status)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end)
Noah
7
You need to do the reverse when the user is uncuffed, which would be to set the 2nd parameter of SetCoreGuiEnabled from false to true.
Would this be an else statement? I don’t know how to get the script started, I know what you mean, I just don’t know what to say in the script to reverse it, sorry about being so clueless.
Noah
9
You could have had a singular event which gives data on weather you should hide or show the backpack, but an easier method would be to just create another event you can fire when the person is un cuffed.
So I made a script, new RemoteEvent, and changed the stuff in the ArrestMechanics, but I’m still having the same problem with it disabling the inventory and not bringing it back.
ArrestMechanics:
local ArrestUser = ReplicatedStorage:WaitForChild("ArrestUser")
local ReleaseUser = ReplicatedStorage:WaitForChild("ReleaseUser")
local AntiReset = ReplicatedStorage:WaitForChild("AntiReset")
local AntiInventory = ReplicatedStorage:WaitForChild("AntiInventory")
local EnableInventory = ReplicatedStorage:WaitForChild("EnableInventory")
local function AntiResetF(PlayerInstance, Status)
AntiReset:FireClient(PlayerInstance, Status)
end
local function AntiInventoryF(PlayerInstance, Status)
AntiInventory:FireClient(PlayerInstance, Status)
end
local function EnableInventoryF(PlayerInstance, Status)
EnableInventory:FireClient(PlayerInstance, Status)
end
local function ReleaseUserF(Player)
local P2 = Player.Character.HumanoidRootPart.CuffWeld.Part1
local P2Instance = game.Players:FindFirstChild(P2.Parent.Name)
Player.Character.HumanoidRootPart.CuffWeld:Destroy()
for i,v in ipairs(P2.Parent:GetDescendants()) do
if v:IsA("MeshPart") then
v.Massless = false
end
end
P2.Parent.Humanoid.WalkSpeed = 16
P2.Parent.Humanoid.JumpPower = 50
P2.Parent.Humanoid.PlatformStand = false
AntiResetF(P2Instance, true)
AntiInventoryF(P2Instance, true)
EnableInventoryF(P2Instance, false)
end
ArrestUser.OnServerEvent:Connect(function(Player, Victim)
local PlayerInstance = game.Players:FindFirstChild(Victim.Parent.Name)
local P1 = Player.Character.HumanoidRootPart
local P2 = Victim
local offset = Vector3.new(0,0.015,-5)
Victim.CFrame = P1.CFrame*CFrame.new(offset)
local NewConstraint = Instance.new("WeldConstraint")
NewConstraint.Parent = P1
NewConstraint.Part0 = P1
NewConstraint.Part1 = P2
NewConstraint.Name = "CuffWeld"
P2.Parent.Humanoid.PlatformStand = true
Victim.Parent.Humanoid.WalkSpeed = 0
Victim.Parent.Humanoid.JumpPower = 0
for i,v in ipairs(Victim.Parent:GetDescendants()) do
if v:IsA("MeshPart") then
v.Massless = true
end
end
AntiResetF(PlayerInstance, false)
print("Arrest")
AntiInventoryF(PlayerInstance, false)
print("Arrest")
EnableInventoryF(PlayerInstance, true)
print("Arrest")
end)
ReleaseUser.OnServerEvent:Connect(function(Player)
ReleaseUserF(Player)
end)
Inventory Enabler:
local StarterGui = game:GetService('StarterGui')
local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local EnableInventory = ReplicatedStorage:WaitForChild()
EnableInventory.OnClientEvent:Connect(function(status)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
end)
Noah
11
If this is the code that is broken, you need to pass the parameter:
SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) > SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, status)
1 Like
Did you mean change it like this?
local StarterGui = game:GetService('StarterGui')
local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local EnableInventory = ReplicatedStorage:WaitForChild()
EnableInventory.OnClientEvent:Connect(function(status)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true) >
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, status)
end)
Here is the error I’m getting:
Script:
local StarterGui = game:GetService('StarterGui')
local ReplicatedStorage = game:GetService("ReplicatedStorage").ArrestSystem
local EnableInventory = ReplicatedStorage:WaitForChild()
EnableInventory.OnClientEvent:Connect(function(status)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, status)
end)
Aspect
14
Remove:
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, true)
1 Like
I did that, but it had the exact same results.
Heres something that could be a little useful
for i,v in pairs(plr.Backpack:GetChildren())
if v:IsEquipped() then
v:Unequip()
end
end
no clue if this works; just look at the docs
system
Closed
17
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.