Hi.
I’m trying to get player’s data via remote function to gui.
Basically, how would I send a table and then get it in local script as for i,v loop. By that, I mean.
This is what I have now:
In Local script: local datas = rFunc:InvokeServer()
and then, it returns from Server Script: return v.Name,cashData:Get(),timeData:Get()
so, in the same local script, I have a for in pairs loop/for i,v loop. Basically, I don’t know, how would i get that data.
Tried that, but didn’t work:
for i,v in pairs(datas) do
local subClone = script.Subject:Clone()
subClone.Parent = script.Parent.ScrollingFrame
subClone.CashVal.Text = v[2]
subClone.TimeVal.Text = v[3]
subClone.Username.Text = v[1]
end
And yeah, not working sadly.
(I didn’t put whole script, but problematic parts only.)
rFunc.OnServerInvoke = function(player,name,beta,cash,skips,timePlayed)
if player:GetRankInGroup(5372074) >= 190 then
for i,v in pairs(game.Players:GetPlayers()) do
local cashData = DataStore2("Cash",v)
local timeData = DataStore2("Time",v)
local MainData = {}
table.insert(MainData, {v.Name,cashData:Get(),timeData:Get()})
print(cashData:Get())
return MainData
end
end
end
Okay, did that. But now, it still shows only one user as gui.
It prints 2 players in that for i loop, but shows only one gui…
Code:
for i,v in pairs(script.Parent.ScrollingFrame:GetChildren()) do
if v:IsA("ImageLabel") then
v:Destroy()
end
end
for i,v in pairs(dataTable) do
--if datas[1] ~= script.Parent.ScrollingFrame:FindFirstChild(datas[1]) then
print(v[1])
local subClone = script.Subject:Clone()
subClone.Parent = script.Parent.ScrollingFrame
subClone.CashVal.Text = v[2]
subClone.TimeVal.Text = v[3]
subClone.Username.Text = v[1]
--end
end
If I don’t put that destroy event, it works. But I want old guis to be destroyed, how would i do that?