01 | local Spawnz = Workspace.Spawnz:GetChildren() --Not GetAllChildren |
02 |
03 | Game.Players.PlayerAdded:connect( function (player) |
04 | local lastSpawn = nil |
05 | player.CharacterAdded:connect( function (character) |
06 | repeat |
07 | local spawn = Spawnz [ (math.random( 1 , #Spawnz) ] |
08 | until spawn ~ = lastSpawn |
09 | lastSpawn = spawn |
10 |
11 | wait() --Let the Character fully load |
12 |
13 | character.Torso.CFrame = spawn.CFrame + Vector 3. new( 0 , 3 , 0 ) |
14 | end ) |
15 | end ) |
There is an error local spawn = Spawnz[(math.random(1, #Spawnz)] <----right there the ] is an error. On the output it says line 7 is an error. Please help me anyone.
01 | Spawnz = workspace.Spawnz:GetChildren() --Not GetAllChildren |
02 |
03 | lastSpawn = nil |
04 |
05 | game.Players.PlayerAdded:connect( function (player) |
06 | player.CharacterAdded:connect( function (character) |
07 | repeat |
08 | curSpawn = Spawnz [ math.random( 1 ,#Spawnz) ] |
09 | until curSpawn ~ = lastSpawn |
10 | lastSpawn = curSpawn |
11 |
12 | wait() --Let the Character fully load |
13 |
14 | character.Torso.CFrame = curSpawn.CFrame + Vector 3. new( 0 , 3 , 0 ) |
15 | end ) |
16 | end ) |