Disable tools in one area

I have an inventory system where people have tools for when the round starts
Unfortunately people can disrupt the server with their tools
So I am wondering how I can disable the tool script in the one area

I have looked at the other topic and I didnt really learn anything from it

If you can help, thanks

  • You can display the backpack in that area if you wanted Like this
-- Check if the player is in the area
game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
  • You can disable scripts in tool like this (Add this inside of the Tool script)
-- Check if the player is in the area
script.Disabled = true

Also I recommend you checking out Zone Plus to check if the Player entered a Zone

Ok, checking out zoneplus

Thanks

1 Like
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.Lobby
local zone = Zone.new(container)

zone.playerEntered:Connect(function(player)
	print(("player entered the zone!"):format(player.Name))
end)

zone.playerExited:Connect(function(player)
	print(("player exited the zone!"):format(player.Name))
end)

script.Disabled = true

Attempted to call require with invalid argument(s). - Line 1

Do you have ZonePlus module in Replicated storage?

yes

i put it there and i got the same error

What is Zone supposed to be? I put a boolvalue and remote event, they didnt work

Weird, works perfectly fine for me, Make sure to add a huge part that is anchored and CanCollide to false

One huge part? so, not a model with a lot of parts called lobby

Yes one part that is invisible and CanCollide is false

Like this but the transparency is 1
image

Dont you put something in replicated storage?

I think thats the problem

Put the module in replicated storage
add a part in workspace named “Zone”
After that add a Script inside of Server Script Service

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.Zone
local zone = Zone.new(container)

zone.playerEntered:Connect(function(player)
	print(("player entered the zone!"):format(player.Name))
end)

zone.playerExited:Connect(function(player)
	print(("player exited the zone!"):format(player.Name))
end)

script.Disabled = true
local Zone = require(game:GetService("ReplicatedStorage").Zone)

local container = workspace.Zone

local zone = Zone.new(container)

zone.playerEntered:Connect(function(player)

print(("player entered the zone!"):format(player.Name))

end)

zone.playerExited:Connect(function(player)

print(("player exited the zone!"):format(player.Name))

end)

script.Disabled = true

Nothing Prints

If nothing works, its ok, its not a big deal anway

I see why, you are disabling the script.
Remove the disable line instead use this

local Zone = require(game:GetService("ReplicatedStorage").Zone)

local container = workspace.Zone

local zone = Zone.new(container)

zone.playerEntered:Connect(function(player)

print(("player entered the zone!"):format(player.Name))

end)

zone.playerExited:Connect(function(player)

print(("player exited the zone!"):format(player.Name))

end)

Now because you are disabling the tool What you could do is add this Script I sent you in server script service.

And when the Player enters you could disable their backpack By adding a Remote event in ReplicatedStorage called “RemoveTools”

zone.playerEntered:Connect(function(player)
     game.ReplicatedStorage.RemoveTools:FireClient(Player)
end) 

After that add a local script inside of StarterPlayerScripts.

game.ReplicatedStorage.RemoveTools.OnClientEvent:Connect(functioon()
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
end)

So basically I tried to do what you said and I got errors
But I think I have found a better way

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.Zone
local zone = Zone.new(container)

game.StarterPack.ClassicBomb.PlantBomb.Disabled = true

zone.playerEntered:Connect(function(player)
	print(("player entered the zone!"):format(player.Name))
end)



zone.playerExited:Connect(function(player)
	print(("player exited the zone!"):format(player.Name))
end)


Now, the tools stays disabled even when I leave the area

This script is quite old, but it still works when inside of the part:

If a player touches the part, all their tools will be removed from the Backpack.

local part = script.Parent

local function remove(otherPart)
    local humanoid = otherPart.Parent:FindFirstChild('Humanoid')
    local player = game.Players:FindFirstChild(otherPart.Parent.Name)
    if humanoid and player then
        local inHand = otherPart.Parent:FindFirstChildWhichIsA('Tool')
        local inBackpack = player.Backpack:FindFirstChildWhichIsA('Tool')
        if inHand then
            inHand:Destroy()
        end
        if inBackpack then
            inBackpack:Destroy()
        end
    end
end

part.Touched:Connect(remove)

Does it add them back when they are out of the zone?

No it doesn’t unless you want to use TouchedEnded which is unreliable.

Just enable it back like I’ve given you an example when the Player enters.

Just do the steps but this time on the remote event do this

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