Hello, I have a problem of my script at the line “for i, Frame in pairs(LeaderboardPart.SurfaceGui.Stat:GetChildren()) do” and got the error:"SurfaceGui is not a valid member of SurfaceGui “Workspace.LeaderboardPart.SurfaceGui”.
I did some debugging and that it prints the uilist,the script itself,and the frame that contains the text.But i still dont know how to fix it.
while true do
for i, Frame in pairs(LeaderboardPart.SurfaceGui.Stat:GetChildren()) do
print(i, Frame)
if Frame.Name ~= "Template" and Frame:IsA("Frame") then
Frame:Destroy()
end
end
RefreshLeaderboard()
wait(refreshtime)
end
Hmmm, if I assume your script is the leaderboard script, have you tried to create a local script which is the direct child of SurfaceGui then do the following:
while true do
for i, Frame in ipairs(script.Parent:WaitForChild("Stat"):GetChildren()) do
print(i, Frame)
if Frame.Name ~= "Template" and Frame:IsA("Frame") then
Frame:Destroy()
end
end
RefreshLeaderboard()
wait(refreshtime)
end
I hope this helps!