i was using zonePlus for convenient reason, everything works well, the player count did what it was supposed to , but when i try to leave it doesnt detect a player exited, so it doesnt minus 1.
zone.playerEntered:Connect(function(plr : Players)
local plrChar = plr.Character or plr.CharacterAdded:Wait()
local humanoid = plrChar:FindFirstChild("Humanoid")
local value = script.PlayerCount
if humanoid and humanoid.Health > 0 then
if not registering[plr.UserId] then
registering[plr.UserId] = true
print(humanoid.Parent.Name .. " Entered")
value.Value += 1
end
end
end)
zone.playerExited:Connect(function(plr : Players)
local plrChar = plr.Character or plr.CharacterAdded:Wait()
local humanoid = plrChar:FindFirstChild("Humanoid")
local value = script.PlayerCount
if humanoid and humanoid.Health > 0 then
if registering[plr.UserId] then
registering[plr.UserId] = nil
print(humanoid.Parent.Name .. " Leave")
value.Value -= 1
end
end
end)