I’m new to scripting and I need help figuring this out. I’m trying to make a GUI system that tells players how much players needed to start the game. It did work, however, it doesn’t say the exact same thing to the other player. The GUI changes for only one player but I want both players to see the exact text at the same time. I’ve read online about RemoteEvents and FireAllClients but I’ve tried understanding it but I simply can’t.
["Players needed to start game"] = 4;
};
wait()
Waiting = game.StarterGui.GameWaiting.MainFrame.TextLabel
if game.Players.NumPlayers <= controltable["Players needed to start game"] then
repeat wait() Waiting.Text = controltable["Players needed to start game"]-game.Players.NumPlayers.." more players needed to start" until game.Players.NumPlayers >= controltable["Players needed to start game"]
Waiting.Text = "Players acquired!"
wait(1)
end
Perhaps you should use .PlayerAdded and .PlayerRemoving to fire the clients. I have an example of something I used here, I will attach it.
function verifyPlayers()
if not gameStarted then -- other variable, saying whether the game started or not
if #players:GetPlayers() >= requiredPlayers then -- if there are enough players
gameStarted = true -- set that variable to say the game has started
initializeGame() -- start the actual game (another function outside of this)
JOIN_CONNECTION:Disconnect() -- stop registering leaves/joins
LEAVE_CONNECTION:Disconnect() -- ^
else
clientGameEvent:FireAllClients('Waiting for players... ('..#players:GetPlayers()..'/'..requiredPlayers..')') -- otherwise, fire all clients telling them how many people are needed.
end
end
end
JOIN_CONNECTION = players.PlayerAdded:Connect(verifyPlayers) -- connection to register players joining, connects to the verifyPlayers function above.
LEAVE_CONNECTION = players.PlayerRemoving:Connect(verifyPlayers) -- same as above but leaving
Also, on a side note, I would probably rename your ControlTable variables to something like ‘PlayersRequired’ or something of that nature, just to simplify.