I have a script that creates a image button with every players name in the server. It makes the gui and I can see it ingame with players in the server in startergui but its not visible in game.
The issue is that your adding it into the startergui instead of the playergui you have to loop through each players ui and edit them because the startergui is only used when players are connecting.
This should work:
function clearList(plr)
for _, item in pairs(plr.PlayerGui.FashionVote:GetChildren()) do
if item:IsA("ImageButton") then
item:Destroy()
end
end
end
function fillList(plr)
clearList(plr)
for _, player in pairs(game.Players:GetChildren()) do
if not plr.PlayerGui.FashionVote:FindFirstChild(player.Name) then
print(plr)
local new = sample:Clone()
new.Name = player.Name
new.NameText.Text = player.Character.Name
new.Votes.Text = player.leaderstats.Votes.Value
new.Parent = plr.PlayerGui.FashionVote
end
end
end
function fillListStartSequence()
for _, player in pairs(game.Players:GetChildren()) do
fillList(player)
end
end
game.Players.PlayerAdded:Connect(fillListStartSequence)
game.Players.PlayerRemoving:Connect(fillListStartSequence)
wait(3)
fillListStartSequence()