So I want to have a scrolling frame list of all players saved in a datastore. I have this frame + text UI stored and clone that, change the text and parent of the frame to the scrolling frame. I can see through the Studio explorer that it works as intended but for some reason the frame doesn’t show up on the scrolling frame, it’s invisible. I know it’s not disabled or transparent, any ideas on how to fix this or of a better process?
Could you show us your script?
Does the scrolling frame have AutomaticCanvasSize enabled? If so, does it have a UIListLayout?
Here’s a snippet of the code where it does all this:
approvedplayers:SetAsync(results,Players:GetNameFromUserIdAsync(results))
local playerui = game.StarterGui.Player:Clone()
playerui.Name = Players:GetNameFromUserIdAsync(results)
playerui.Username.Text = Players:GetNameFromUserIdAsync(results)
playerui.Parent = game.StarterGui.RankLock.Frame.ApprovedPlayers.ScrollingFrame
It has a UIList constraint but AutomaticCanvas is set to None.
Try setting the ScrollingFrame’s size to 1,0,1,0, set the CanvasSize to 1,0,0,0 and set the AutomaticCanvasSize to Y.
Doesn’t work, still invisible.
Any output errors? Could you show your hierarchy?
Starter Gui
V
Rank Lock
V
Frame
V
Approved Players
V
Scrolling Frame
V
UI List Layout
And no errors from the output.
@7z99
Also when I run the part where I set the clone’s parent to the scrolling frame outside of the function where this executes, everything works. Only when it’s inside the function call it doesn’t work for some reason. Here’s the full function that’s run.
Oh, think I see the issue. It’s probably because you have to parent it to Players > Player > PlayerGui, not StarterGui.
Thanks! That worked, do you know if it will show up on every other player’s screen as well?
No, it will only show up on the player you indexed.
How would I set it up so that it syncs across all UI’s?
Your best bet would be to use a remote event to send a table of all the players to each of the clients using :FireAllClients as it would create the frame on the client and doesn’t have any replication issues.
If you want to do something on the server only (which I advise you don’t do), you could just loop through all of the players using a for loop.
for i,v in pairs(players:GetPlayers()) do
-- insert the ui
end