for i, v in pairs(datatable) do
CloneText:Clone()
CloneText.Parent = script.Parent.Parent.StarterGui.ScreenGui.FrameE.FrameC.ScrollingFrame
CloneText.Text = v
end
Datatable has multiple entries in it, however when a player is added it only picks one of the items in the table and clones 1 text label instead of cloning a textlabel for each item in the table.
Expected Result: Clones 5 Text labels (theres 5 things in the table)
local RepStorage = game.ReplicatedStorage.Remotes
local DataStore = game:GetService(“DataStoreService”)
local Data = DataStore:GetDataStore(“DataInputSaves”)
local datatable = {}
local CloneText = game.ReplicatedStorage.UIClones.TextLabel
game.Players.PlayerAdded:Connect(function(plr)
datatable = Data:GetAsync(plr.UserId)
for i, v in pairs(datatable) do
CloneText:Clone()
CloneText.Parent = script.Parent.Parent.StarterGui.ScreenGui.FrameE.FrameC.ScrollingFrame
CloneText.Text = v
end
end)
Already made a print, and checked before hand. I just deleted it from the script to show you guys. I need help with cloning the text-label though for each entry
game.Players.PlayerAdded:Connect(function(plr)
datatable = Data:GetAsync(plr.UserId)
for i, v in pairs(datatable) do
local CloneText = game.ReplicatedStorage.UIClones.TextLabel:Clone()
print(i..": "..v)
CloneText.Parent = script.Parent.Parent.StarterGui.ScreenGui.FrameE.FrameC.ScrollingFrame
CloneText.Text = i..": "..v
CloneText.Name = i
end
end)