I have a textLabel that i want to change what it says when the amount of players is more than 2. Everything works fine buttt.... it doesn't change. I have to reset to see the difference. Is their something i'm overlooking or am i gonna have to use a different text GUI?
I've run into this problem a lot of times with games I've made, the #1 solution I have found was to put a StringValue into Lighting and name it "Alert" and do the following
Script that changes the text:
local alert = game.Lighting.Alert alert.Text = "Test String" wait(2) alert.Text = "Test #2"
Script Inside the TextLabel:
local alert = game.Lighting.Alert update = function() script.Parent.Text = alert.Value end update() alert.Changed:connect(update)
for i,v in pairs(game.Players:GetChildren()) do v.PlayerGui.GUIAndLocationHere end
This code will loop through all the players currently in the game and execute the action per player.
Rather than iterating through each player, I'd have a script inside each GUI that updates the TextLabel
when the number of players changes. If I was you, this is what I'd have-
local Label = script.Parent local Players = Game:GetService("Players") function update() Label.Text = Players.NumPlayers .. " players" end Players.Changed:connect(function(property) if property == "NumPlayers" then update() end end)