Tables and CFraming issues, any help?
Basically, I'm trying to make a spawning system using tables. Every time a player is spawned, the spawn they are going to be spawned in will be removed from the table, so no other player will be sharing their spawn. Afterwards, once everyone is spawned, the game continues. However, it doesn't remove it from the table and instead still makes people share spawns.
I tried making a for loop to find if any of the selected spawns equaled to the index but that didn't work.
I also tried following tutorials, but that didn't work.
I've been trying to find a fix for a while now, but I eventually gave up.
Any help fixing would be greatly appreciated.
1 | for i = 1 ,PlayerCount do |
2 | if not PlayerTable [ i ] .AFK.Value and PlayerTable [ i ] .Character and PlayerTable [ i ] .Character.Humanoid.Health > 0 then |
3 | local Spawns = workspace.CurrentMap:FindFirstChild(MapChosen).Spawns:GetChildren() |
4 | local Character = PlayerTable [ i ] .Character |
5 | Character.HumanoidRootPart.CFrame = Spawns [ 1 ] .CFrame + Vector 3. new( 0 , 2 , 0 ) |