So I have a little project where you can make little humans and you can create different civilizations with them, and you can make them go to battle, etc. (Look up worldbox for more info). So you can spawn humans, but I set the human limit to 125 characters. If you have an autoclicker at max speed the play can easily bypass this.
So the issue is that, when you spawn in a lot of humans, it goes into untracked memory and of course the game lags. Why does it go into untracked memory?
Also, how could I prevent the players from bypassing this limit without having to make some sort of anti-autoclicker script?
my code for the humans spawning (local):
Mouse.Button1Down:Connect(function()
if HumansSelected == false then return end
HumanCount = 1
for _,v in pairs(game.Workspace.IslandFolder.Humans:GetChildren()) do
HumanCount = HumanCount + 1
end
script.Parent.Parent.IslandSettings.MainFrame.IslandInfoFrame.HumanCount.Count.Text = HumanCount
if HumanCount >= 125 then warn("Too many humans") return end
SpawnHumanEvent:FireServer(Mouse.Hit.p)
end)