I need a bit of help. I’m making a open world type of game that needs enemies in it. But because its infinite generation and there’s a max render I need a way of spawning Parts for a starter around the player.
I could not find any tutorials on this so i have came to the dev forum for help.
To get a new NPC spawn position close to the player I would suggest using the player Position and then adding a Vector3 with some randoms in it, so:
local radius = 20 -- Change this value to how far you want max spawn pos to be
local NPCspawnPos = aCharacter.PrimaryPart.Position + Vector3.new(math.random(-radius , radius ), 3, math.random(-radius , radius )
-- The "3" is the helight NPC will spawn at, so around Hip Height
I have tried many things with this script it is not working as intended,
Where does it go?
Where do I put my enemy model?
Heres some screenshots of the output and more: