How would I put table info into a GUI?

I have a template that replicates from ReplicatedStorage into a GUI for a scrolling frame.
I want it to implement the information from a table to duplicate it over and over for each entry.

This is how my table is but it all counts as 4 different slots, I want it to be the User and Contribution collected into one thing for easy access?!

local StaffList = {
	"PlayerUsername", "PlayerContributions",
	"PlayerUsername", "PlayerContributions",
}

^ Would this be like the following?

local Staff= {
    Staff1= {
        name = "person";
        contribution = "helped me with something";
    };
 Staff2= {
        name = "guy";
        contribution = "helped me with something also";
    };
}

But then how would I find the slot number the info is in to get it into the GUI>?!>?!?!?
I’m not sure how to do this.

I’m sorry I have no idea how to explain this. I can’t seem to figure out the right words.

This is the current script, not sure how would I start with the table to GUI stuff…

local creditsFrame = LoadingGUI.creditsFrame
local creditsScrolling = creditsFrame.ScrollingFrame
local creditsMainButton = creditsFrame.mainButton
local creditsFrameTitle = creditsFrame.TitleText
local creditsTemplate = game.ReplicatedStorage:WaitForChild("CreditsTemplate")

local NewEntry = creditsTemplate:Clone()
NewEntry.Parent = creditsScrolling
NewEntry.playerName = --(slot one of the table)
NewEntry.playerContributions = --(slot two of the table)
NewEntry.Name = --(slot one of the table)

Try reading into the tables api reference, in the part of writing/reading over dictionaries

does this seem like im going atleast close on the right track

local Staff= {
	Staff1= {
		name = "Dalestart";
		contribution = "helped me with nothing";
	};
	Staff2= {
		name = "Zachory";
		contribution = "helped me with nothing also";
	};
}

local StaffTable = {}

for i, v in pairs(Staff) do
	StaffTable[i] = {}
	StaffTable[i]["name"] = v.Name
	StaffTable[i]["contributions"] = v.contributions
end

local NewEntry = creditsTemplate:Clone()
NewEntry.playerName = --(I STILL HAVE NO CLUE WHAT IM DOING HERE)

You definetly have the right idea, if you want the slot number you can just use a regular array instead of using a dictionary inside a dictionary. So like:

local Staff= {
	{
		Name = 'Joe',
		Contribution = 'plugged in the wifi'
	},
	
	{
		Name = 'Rob',
		Contribution = 'fed me'
	},
}

the way you would access any values would be like:
Staff[1].Name, (joe)
Staff[1].Contribution (gave me wifi)

If you wanna iterate for each of these into your gui you could do something like:

for i,member in ipairs(Staff) do
	local name,contribution = member.Name,member.Contribution
	
	local newentry = clone()--the entry clone
	newentry.playerName.Text = name
	newentry.playerContributions.Text = contribution
end
2 Likes

THANK YOU!!!
#1 person on devforum

i got so mad at this for no reason thank you

1 Like