#zombie spawner

1 messages · Page 1 of 1 (latest)

frigid crystal
#

i wanna spawn zombies on random positions in the map but i dont know how can anyone help??

deep harbor
#

Wouldnt you make a rng for the pos of zombies ?

urban ridge
#

and also you can do :Clone on the zombie model that you have

lime thunder
urban ridge
#

i dont really like that

lime thunder
#

its good for beginners

urban ridge
#

ig?

#

but either way, what i said and he said can be used

tranquil linden
#
local function findRandomSpawnPoint()
    local mapSize = 500 --map size in here
    local randomX = math.random(-mapSize/2, mapSize/2)
    local randomZ = math.random(-mapSize/2, mapSize/2)
    local skyPosition = Vector3.new(randomX, 200, randomZ) --how far it start
    
    local raycastParams = RaycastParams.new()
    raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
    raycastParams.FilterDescendantsInstances = {} -- add here things to ignore
    
    local rayResult = workspace:Raycast(skyPosition, Vector3.new(0, -300, 0), raycastParams)
    
    if rayResult then
        return rayResult.Position + Vector3.new(0, 5, 0) 
    end
    return nil
end
#

also as cash said you can create invisable parts around you map as spawn points which is the only positive thing about it thats it more controlled

#

you can also do spawn regions , for example

local spawnRegions = {
    {min = Vector3.new(-100, 0, -100), max = Vector3.new(100, 0, 100)}, -- center
    {min = Vector3.new(200, 0, -50), max = Vector3.new(300, 0, 50)}     -- side
}
frigid crystal
#

oh ok

#

thanks!

urban ridge
urban ridge
frigid crystal
#

wait lemme try

urban ridge
#

thats the fun of scripting

frigid crystal
#

where do i need to place the script?

#

@urban ridge

urban ridge
#

server script service

frigid crystal
#

oh ok

#

i dont know what to type in map size, i have four walls, with the size 400, so that means i need to type 400 in mapSize?? ||@urban ridge||

frigid crystal
#

400x400 i think

#

400x396

fallow fulcrumBOT
#

studio** You are now Level 2! **studio

frigid crystal
#

so??

#

now what

urban ridge