local label = game.StarterGui.TimeLeft.Frame.TimeLeftLabel local ready = game.StarterGui.TimeLeft.Frame.Ready.ReadyToVisit local currentmin = currentdaymin + currenthourmin + currentminutemin local beforemin = beforedaymin + beforehourmin + beforeminutemin local timeoffline = math.abs(currentmin - beforemin) print(currentmin) print(beforemin) print(timeoffline) while true do if ready.Value == false then repeat print("repeat") label.Text = timeoffline wait(5) until ready.Value == true end wait(5) end end
This is in a script in the workspace. The repeat thing keeps on going, but the text isn't changed, even if I make the text say "test".
Help? How can I change the local text using a script?
Update/Breakthrough I looked at the startergui and playergui, and the startergui is updated to 0 so when I reset, it works. I haven't tested it yet, but will it make it 0 for all the players, or just for the local?
local label = game.StarterGui.TimeLeft.Frame.TimeLeftLabel local ready = game.StarterGui.TimeLeft.Frame.Ready.ReadyToVisit local currentmin = currentdaymin + currenthourmin + currentminutemin local beforemin = beforedaymin + beforehourmin + beforeminutemin local timeoffline = math.abs(currentmin - beforemin) print(currentmin) print(beforemin) print(timeoffline) Game.Players.PlayerAdded:connect(function(player) coroutine.resume(coroutine.create(function() local PlayerGui = player:WaitForChild('PlayerGui') local ready, label = PlayerGui.TimeLeft.Frame.Ready.ReadyToVisit, PlayerGui.TimeLeft.Frame.TimeLeftLabel while true do if not ready.Value then repeat label.Text = timeoffline wait(5) until ready.Value end wait(5) end end end
You seem to want something like this, please inform me if I am mistaken.
This script would be best as a local script in StarterGui. Other than that and the comments below, I don't have much to add.The loop at the end might need some work, but I don't know what you need to do with it.
local label = game.StarterGui.TimeLeft.Frame.TimeLeftLabel --change "game.StarterGui" to "LocalPlayer.PlayerGui". local ready = game.StarterGui.TimeLeft.Frame.Ready.ReadyToVisit -- same here local currentmin = currentdaymin + currenthourmin + currentminutemin local beforemin = beforedaymin + beforehourmin + beforeminutemin local timeoffline = math.abs(currentmin - beforemin) print(currentmin) print(beforemin) print(timeoffline) while true do if ready.Value == false then repeat print("repeat") label.Text = timeoffline wait(5) until ready.Value == true end wait(5) end
To change the GUI for every player at once, use a for
loop.
However, this is not the optimal method, due to your use of the 'ready' value. I suggest either making this a LocalScript inside StarterGui that every player gets, or changing where the ready Value is located, so that there is only one of it.