local StarterGui = game:GetService("StarterGui") local TextBox = StarterGui.ScreenGui.TextBox game.Players.PlayerAdded:Connect(function(player) for i = 1,60,1 do TextBox.Text = i wait(0.1) break end end)
It's actually a quick fix, I've done the same issue myself in one of my own loops. (This assumes the script is in the workspace)
local StarterGui = game:GetService("StarterGui") local TextBox = StarterGui.ScreenGui.TextBox game.Players.PlayerAdded:Connect(function(player) for i = 1,60,1 do TextBox.Text = i wait(0.1) break end end)
You have a "break" after the "wait(0.1)" which ends the loop right away after the first iteration, just remove it like this:
local StarterGui = game:GetService("StarterGui") local TextBox = StarterGui.ScreenGui.TextBox game.Players.PlayerAdded:Connect(function(player) for i = 1,60,1 do TextBox.Text = i wait(0.1) end end)
That should do the fix, I didn't fully check the script for any other issues. (Before my relook)
Now after a relook, there's also another issue that other users were talking about in the comments, it doesn't update for other players. I also have a QUICK fix for that!
local Players = game:GetService("Players") local StarterGui = game:GetService("StarterGui") local TextBox = StarterGui.ScreenGui.TextBox game.Players.PlayerAdded:Connect(function(player) for i = 1,60,1 do for i,plr in pairs(Players:GetPlayers()) do local TextBox = plr.PlayerGui.ScreenGui.TextBox if TextBox then TextBox.Text = i end end wait(0.1) end end)
And to add to it, I think you're trying to get the amount of players, that is really easy to get!
game.Players.PlayerAdded:Connect(function(player) playercount = #game.Players:GetPlayers() for i,plr in pairs(game.Players:GetPlayers()) do local TextBox = plr.PlayerGui.ScreenGui.TextBox if TextBox then TextBox.Text = i end wait(0.1) end end)
Sorry my answer is all over the place, but that last one should work!
You can't use a playeradded event inside of a gui or edit the startergui. Use a localscript inside of the textlabel with the following text
local TextBox = script.Parent local iscounting = true while iscounting do wait(1) if TextBox.Text ~= 0 then TextBox.Text = TextBox.Text - 1 end end