So far I tried to make the for i loop count, but it wouldn't work. It would instead just show as a label with the text implying "label" how would I overcome this issue?
local plr=game.Players.LocalPlayer local s = Instance.new("ScreenGui") s.Name = "AIGui" s.Parent = plr:WaitForChild("PlayerGui") local f = Instance.new("Frame",s) f.Size = UDim2.new(0,400,0,250) f.Position = UDim2.new(0,540,0,100) f.BackgroundColor3 = Color3.new(255,0,0) f.BackgroundTransparency = 0.7 wait(1) local tl = Instance.new("TextLabel",f) tl.Position = UDim2.new(0,50,0,165) tl.TextSize = 15 local a = game.Teams.Raiders:GetChildren() for i = 1, #a do tl.Text = AI..":"..i end
local Team = {game.Teams.Raiders,game.Teams.["EnterOtherTeamNameHere"]} local x local y for _, Player in pairs(game.Players:GetChildren()) do if Player.Team == Team[1] then x = x + 1 --Do whatever elseif Player.Team == Team[2] then y = y + 1 --Do whatever end end tl.Text = AI..":"..x
You will probably need to modify this to be compatible with your script.
If I understand your question correctly, you want to get the number of players.
local numOfPlrs = #game.Players:GetChildren() tl.Text = AI .. ":" .. numOfPlrs
NOTE: This won't change if players leave or join. So you just have to create a function that updates the Text. And hook up event listeners to it.