So I am trying to respawn all the players with LoadCharacter on the server but I am getting the error "LoadCharacter can only be called when Player is in the world."
My script:
function SpawnPlayers() print("Spawining Players") for i, player in ipairs(players) do player:LoadCharacter() end end
You are probaly using the "players" in line 3 as a varible that says "game.Players:GetPlayers()" or "game.Players:GetChildern()" but when you do that, it does not do the players in a table again. So it tries to put all the players in a table when you assing the table. But then the players are not in the game yet. So you should instead use
function SpawnPlayers() print("Spawining Players") for i, player in in pairs(game.Players:GetPlayers()) do player:LoadCharacter() end end
so it will go through all the players that are currently in the game and not only the players when you assinged the table. I hope this helps