#Random spawngroup system isnt working

16 messages · Page 1 of 1 (latest)

icy cypress
#

Try using Model:MoveTo(Vector3)

#

For example

character:MoveTo(selectedspawn1.Position)
#

Also the player is still loading when the characteradded fires so I would put a task.wait

young topaz
#

where do i put task. wait?

icy cypress
#

task.wait(#)

#

before everything

#

in the function

#

local function onCharacterAdded(character)
task.wait(1)
print(character.Name .. " has spawned")

local rand = math.random(1,2)
print(rand)

if rand == 1 then
    local parts1 = SpawnG1:GetChildren()
    local selectedspawn1 = parts1[math.random(1,#parts1)]
    character.Torso.CFrame = selectedspawn1.CFrame

elseif rand == 2 then
    local parts2 = SpawnG2:GetChildren()
    local selectedspawn2 = parts2[math.random(1,#parts2)]
    character.Torso.CFrame = selectedspawn2.CFrame
end    

end

young topaz
#

it worked

#

thanks

icy cypress
#

👍

young topaz
#

i tried earlier but i just wrote wait(1) instead of task.wait

#

thank you

icy cypress
#

Yes task library is better than wait, I am pretty sure wait is deprecated

ancient thunder
#

wait isnt deprecated

icy cypress
#

My bad