#ZonePlus Help

1 messages · Page 1 of 1 (latest)

stray kernel
#

So as i was developing my hangout game, I tried using ZonePlus to create a basic zone that gives you a combat tool, which was not working. It was also suppost to print "Player Entered Zone" and "Player Exited Zone."

Now when i created a new baseplate, imported the same scripts and parts, the zone worked fine. I dont understand why it isnt working. any help?

#

new baseplate as in new place btw

stray kernel
#
local RR = game:GetService('ReplicatedStorage')
local Zone = require(RR.Zone)

local fightzone = Zone.new(workspace.Part)

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

    if not player.Backpack:FindFirstChild('ClassicSword') and not player.Character:FindFirstChild('ClassicSword') then

        local sword = RR.ClassicSword:Clone()
        sword.Parent = player.Backpack

    end
end)

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

    for _, tool in pairs(player.Backpack:GetChildren()) do
        if tool:IsA('Tool') and tool.Name == 'ClassicSword' then
            tool:Destroy()
        end
    end

    for _, tool in pairs(player.Character:GetChildren()) do
        if tool:IsA('Tool') and tool.Name == 'ClassicSword' then
            tool:Destroy()
        end
    end

end)```
stray kernel
#

@topaz sage

#

it works in any game but this one game im developing on

#

i dont know why

topaz sage
#

do you potentially need to allow API requests in security?

stray kernel
#

let me check

atomic carbonBOT
#

studio** You are now Level 1! **studio

stray kernel
#

all the required things are on

astral summit
#

is the part canquery

topaz sage
#

can you show me your experience setup?

stray kernel
stray kernel
#

theres barely any other scripts besides it

#

these

topaz sage
#

i just started using ZonePlus yesterday lemme see my script and compare

#
local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local Zone = require(ReplicatedStorage:WaitForChild("Zone"))  -- try waiting for zone

local part = workspace:WaitForChild("Part") -- wait for part
local fightzone = Zone.new(part)

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

    local hasSword = player.Backpack:FindFirstChild("ClassicSword") or 
                     (player.Character and player.Character:FindFirstChild("ClassicSword"))

    if not hasSword then
        local swordTemplate = ReplicatedStorage:FindFirstChild("ClassicSword")
        if swordTemplate and swordTemplate:IsA("Tool") then
            local swordClone = swordTemplate:Clone()
            swordClone.Parent = player.Backpack
            print("Gave sword to " .. player.Name)
        else
            warn("ClassicSword not found or not a Tool")
        end
    end
end)

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

    for _, tool in ipairs(player.Backpack:GetChildren()) do
        if tool:IsA("Tool") and tool.Name == "ClassicSword" then
            tool:Destroy()
            print("Removed sword from backpack")
        end
    end

    if player.Character then
        for _, tool in ipairs(player.Character:GetChildren()) do
            if tool:IsA("Tool") and tool.Name == "ClassicSword" then
                tool:Destroy()
                print("Removed sword from character")
            end
        end
    end
end)
#

try this

#

my guess is some experiences your thing is loading fast enough that its not an issue

wind atlas
topaz sage
#

also ideally put it inside serverscriptservice -- the zoneplus module

wind atlas
#

script looks like it should be server script

stray kernel
#

ok

#

because the script was put in a part (an area with no collision)

stray kernel
#

i have autocharacterload

#

on

#

btw