#How to get Players that in the Zone
1 messages · Page 1 of 1 (latest)
local module = {}
function module.new()
local self = {}
local plrChange = {}
-- Функция запуска зоны
function self.StartZone(zonePart, radius)
while true do
for _, plr in pairs(game.Players:GetPlayers()) do
local chr = plr.Character or plr.CharacterAdded:Wait()
local hrp = chr:FindFirstChild('HumanoidRootPart')
local change = plr:FindFirstChild('Change')
if plrChange[plr] == nil then
plrChange[plr] = {plrChange = nil}
end
local distance = (plr.Character.HumanoidRootPart.Position - zonePart.Position).Magnitude
if distance <= radius then
if plrChange[plr].Change == false then return end
print('Plr in Zone!')
change.Value = false
plrChange[plr].plrChange = false
elseif distance > radius then
if plrChange[plr].Change == true then return end
change.Value = true
plrChange[plr].plrChange = true
end
end
task.wait(0.3)
end
end
return self
end
return module
that my code
so like i said its workin but have a big abt 3 minutes freez
and if just comma the change.Value then its not lagging but if i stand for like 5 minutes in a zone fps is getting very low
pls help
oh i found that if i change my Change Value in game not by code it lagging too
** You are now Level 3! **
picking my nose rn
thats weird
huh