I do not know how to word this title, so I hope this description helps you understand it more.
On the bottom of a player’s screen, I have a TextLabel. I am updating a StringValue on the server and using
:Changed in a LocalScript so that the game doesn’t have to constantly loop through the players and change each text indvidually.
However, when a player first joins the game, the TextLabel does not change despite it changing on other player’s screens. My guess is that the player was not in the server when the text changed and therefore did not receive the Changed signal from the value. (Please tell me if I’m wrong here.)
I’ve tried in the past quickly changing the Value locally for the client to nil and then returning it to a previous value, however it does not work the majority of the time. I’d much rather not take a shot in the dark for the player; what if the message is important for them?
I’ve tried numerous solutions but could not seem to find a solid fix. How would I make it so the Text on a TextLabel is updating accordingly to a StringValue immediately when they join? It’s changed on the server, so I’m pretty sure it should load in for each individual player, correct?
yes u are right, anyways ur system is fine u should only add a remote event on the playerAdded function so u can send to the new player the current state
What if when you update the StringValue’s Value, the local script hasn’t loaded yet? (especially to consider when the localscript is somewhere in PlayerGui or its descendants)
Try yielding on the server, to see whether stuff has loaded for a player:
(method from a post in Community Resources)
local Players = game:GetService("Players")
local function OnAdded(player)
for _, g in ipairs(game.StarterGui:GetChildren()) do
-- change value here
Parent a local script to StarterGui directly, with this code:
for _, v in ipairs(script.Parent:GetChildren()) do
if v:IsA("ModuleScript") then
In a ModuleScript under StarterGui, listen to the Changed event and print the value.
What i find works for me is if you add a:
repeat wait() until game.Loaded
At the top of the script, this will wait for the game to load on the client’s side, Then there should be no errors with values not being set due to the player not joining in time etc.
But this way, it’ll only yield until all instances have replicated - there’s still the possibility items will replicate after the value is changed on the server, and there’s no way to do this on the server.
Ah nvm i assumed this was a localscript issue.
Requires an initial set.
local function onValueChanged(newValue)
textLabel.Text = newValue