Let me clarify what I'm trying to so. I have 12 bricks in a model, each with a SurfaceGui and TextLabel. I want to display a single player on each brick with their name on the TextLabel.
Here is my script below. Please do not comment on my scripting methods unless you know what you are talking about, and can provide a more efficient way to write it.
plr = game.Teams.Racing:GetPlayers()
function update()
local c = script.Parent:GetChildren()
for i = 1,#c do
if string.sub(c[i].Name, 1, 5) == "Yield" then
c[i].SurfaceGui.TextLabel.BackgroundTransparency = 1
c[i].SurfaceGui.TextLabel.Text = ""
end
end
for i = 1,#plr do
local item = script.Parent:FindFirstChild("Yield" .. tostring(i)).SurfaceGui.TextLabel
if (item~=nil) then
item.BackgroundTransparency = 0
item.Text = plr[i].Name
end
end
end
spawn(function()
while wait() do
update()
end
end)
Many thanks, Salt
