I’m just calling player:LoadCharacter() on the server, and a player has a gui called status that shows the status of the game, there is a localscript inside this status that ONLY changes the text of a textLabel when it receives the event to update the status but somehow it breaks? Doesn;'t reiceive the event at all
local function setupPlayers()
for _, player in Players:GetPlayers() do
player:LoadCharacter()
local character = player.Character
if not character then
return
end
local primaryPart = character.PrimaryPart
if not primaryPart then
return
end
local humanoid = character:FindFirstChild("Humanoid", true)
if not humanoid then
return
end
table.insert(playersInGame, player)
humanoid.Died:Once(function()
table.remove(playersInGame, table.find(playersInGame, player))
if #playersInGame == 0 then
updateStatusRemoteEvent:FireAllClients("Everyone died! Restarting game...")
task.delay(3, initialize)
return
end
end)
local spawns = map.Spawns:GetChildren()
local randomSpawn = spawns[math.random(1, #spawns)]
primaryPart.CFrame = randomSpawn.CFrame * CFrame.new(0, 5, 0) -- Prevent the player from spawning inside the floor
end
end
local function startGame()
setupPlayers()
for stageNumber, stageData in STAGE_DATA do
updateStatusRemoteEvent:FireAllClients(`Game ongoing, stage: {stageNumber}`)
print("Fired")
end
end
Maybe you should wait for each player character to load before sending the events OR wait only for the last player character to load because by then the rest would have already loaded.