Google translator, sorry
local value = workspace.PlayerValues.BrownMaterial.Value while true do game.StarterGui.HudGui.MainFrame.PlayerStats.BrownMaterial.Text = value wait() end
I showed the value of a variable, everything is OK, but if it changes, the text of the textlabel remains the same
The StarterGui
holds GUIs to be later copied and given to players when they spawn.
There is no point in your scripts changing its contents.
You should use a LocalScript and modify the current player's GUI:
-- I assume that this script is a child of "HudGui": local value = workspace.PlayerValues.BrownMaterial.Value while true do script.Parent.MainFrame.PlayerStats.BrownMaterial.Text = value wait() end
However, you never "refresh" value
-- the script saves the value that it was when it sets value = ......
.
You need to grab value
again in each iteration of the while
loop if you want to show the "live" value:
while true do local value = workspace.PlayerValues.BrownMaterial.Value script.Parent.MainFrame.PlayerStats.BrownMaterial.Text = value wait() end