You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve?
I’m currently challenging my basic programming skills with gui interface. In short, I ran in to a problem with pairs of i,v and need some help with the error I made that I can’t seem to debug. -
What is the issue?
The function “BoxDisplay” seems to not recognize the textbuttons that have been looped on being found in the function, as it prints nil when I put v in a table to debug and only prints out “Exit” when I print out “Table[1]” which is an image button, when I try to find the rest such as "Table[2], it prints out nil. -
What solutions have you tried so far?
Currently I could not find a fix to this problem, from printing, I can only assume that It’s trying to find the buttons while it hasn’t loaded, but the variable of MainPanel already has the WaitForChild trigger, so it should’ve rendered the buttons.
-- Don't mind the names of the variables, I just like taking it seriously, also I haven't done scripting for awhile now so do forigve me if this was a simple fix all along
Panel = script.Parent
Players = game:GetService("Players")
ReplicatedStorage = game:GetService("ReplicatedStorage")
MainPanel = Panel:WaitForChild("Main GUI")
PlayerList = MainPanel:FindFirstChild("PlayerList")
Staff = Players.LocalPlayer
PlayerBar = ReplicatedStorage:WaitForChild("TextButton")
RandomWeapons = ReplicatedStorage:WaitForChild("RandomWeapons")
function StartUp()
MainPanel:FindFirstChild("Developer Panel.").Text = Staff.Name .. ": Administrator Panel"
end
function System()
for i,v in pairs(Players:GetChildren()) do
local CloneHolder = PlayerBar:Clone()
CloneHolder.Parent = PlayerList
CloneHolder.Name = v.Name
CloneHolder.Text = v.Name
end
end
function BoxDisplay()
for i,v in pairs(MainPanel:GetChildren()) do
local Table = {v}
print(Table[2])
v:FindFirstChildOfClass("TextButton").MouseButton1Click:Connect(function()
if v.Name == "Placeholder" then
print("Worked!")
elseif v.Name == "Menu" then
print(v.Name, "Worked!")
elseif v.Name == "Testing" then
print(v.Name, "Worked!")
elseif v.Name == "Moderation" then
print(v.Name, "Worked!")
elseif v.Name == "Development" then
print(v.Name, "Worked!")
end
end)
end
end
System()
StartUp()
BoxDisplay()