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
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
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)
Are the tools that you want to get back, available to anyone who plays?
@lilmazen1234 also, how is the TouchEnded unreliable?
Some of the time Touched ended doesn’t work. (Very Unreliable)
A Topic about it (Check the Solution)
It would be better to use Zone Plus as it’s efficient unlike TouchedEnded
Zone+ still works but I’d suggest using the spatial query API if you want a more lightweight implementation. Both methods should work well though.
If you want to hide the backpack, then you can do like this
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HideToolsEvent = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("HideTools")
local StarterGui = game:GetService("StarterGui")
HideToolsEvent.OnClientEvent:Connect(function(Value)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, Value)
end)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Zone = require(ReplicatedStorage:WaitForChild("Zone"))
local container = workspace:WaitForChild("Zone")
local zone = Zone.new(container)
local HideToolsEvent = ReplicatedStorage:WaitForChild("Remotes"):WaitForChild("HideTools")
zone.playerEntered:Connect(function(player)
HideToolsEvent:FireClient(player, false) -- Send false to hide the backpack
end)
zone.playerExited:Connect(function(player)
HideToolsEvent:FireClient(player, true)
end)
and it should work just fine
robloxapp-20220815-2037475.wmv (630.4 KB)
Place file
Zone.rbxl (71.2 KB)