Is it possible to only spawn an NPC if a player is within a certain radius of its spawn position? And would this help prevent lag?
Yes, it is possible to do so using Magnitude, and can definitely decrease lag because the player has to render less. here is an example:
local spawnposition = --NPC's spawn position local player = script.Parent --use this as a script under the player local maxdistance = 200 --you can change this if you want while true do if player.Character then if (player.Character.HumanoidRootPart.CFrame.Position - spawnposition).Magnitude <= maxdistance then --spawn npc break --stops the loop end end wait(2) --to prevent lag end
Yes, You could track the players position when they respawn
It might reduce lag but i’m not sure
Thank you. I will test this out and get back to you.