Here is my code right now, I've got an array that adds players inside of it when they're in the region, so the only people that will have "pvp" value set to true is the people inside the region, but when I step outside of the region the value is still set to true? I'm not sure what the issue is. I have no errors either.
local Arena1 = game.Workspace.Arenas.Arena1
local Arena2 = game.Workspace.Arenas.Arena2
local RegionPart = Arena1.Region
local size = RegionPart.Size
local max = RegionPart.CFrame.p + (0.5 * size)
local min = RegionPart.CFrame.p - (0.5 * size)
local Region1 = Region3.new(min, max)
local GamePlayers = game.Players
local ignorelist = {Arena1}
while wait() do
local partsInRegion = workspace:FindPartsInRegion3WithIgnoreList(Region1,ignorelist,math.huge)
local playersInRegion = {}
for i,v in pairs(partsInRegion) do
if v.Parent:FindFirstChild("Humanoid") ~= nil then
local player = game.Players:FindFirstChild(v.Parent.Name)
playersInRegion[player.Name] = true
v.Parent.PlayerValues.pvp.Value = true
end
for a,b in pairs(GamePlayers:GetChildren()) do
print("Check1")
if playersInRegion[b.Name] == nil then
plr = game.Workspace:FindFirstChild(b.Name)
plr.PlayerValues.pvp.Value = false
print("Check3")
end
end
end
end
