I got a little script (using ZonePlus v3.2.0) and it’s supposed to change a value for a player to true when the player walks into the area. When someone walks in, nothing happens, it doesn’t change the value. It does print that someone enters the area, though. This script also checks if the value is equal to true, and if it is, give player one point.
Here’s my script:
local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.OnGroundZone
local zone = Zone.new(container)
zone.playerEntered:Connect(function(plr)
local IsInZone = plr.IsInZone.Value
IsInZone = true
print(("%s entered the zone!"):format(plr.Name))
print(IsInZone)
end)
zone.playerExited:Connect(function(plr)
local IsInZone = plr.IsInZone.Value
IsInZone = false
print(("%s exited the zone!"):format(plr.Name))
print(IsInZone)
end)
while wait(1) do
for _, v in pairs(game:GetService("Players"):GetChildren()) do
local IsInZone = v.IsInZone.Value
if IsInZone == true then
v.leaderstats.Points.Value = v.leaderstats.Points.Value + 1
elseif IsInZone == false then
print(IsInZone)
end
end
end
What is wrong with my script?