Hello,
I have a serverscript that doesn't work, and I have no idea why..
I'm trying to revamp an old Minigames game, but I'm not the best at scripting, so here is the code:
minigames = {}
local m = game.ServerStorage.Choices:GetChildren()
for i=1,#m do
table.insert(minigames, m[i])
end
things = script.Parent:GetChildren()
for i=1,#things do
if things[i].className == "TextButton" then
things[i].Text = minigames[i].Name
else
table.remove(things, i)
end
if things[i].className == "Script" then
table.remove(things, i)
if things[i].className == "UIGridLayout" then
table.remove(things, i)
if things[i].className == "BoolValue" then
table.remove(things, i)
else
things[i].MouseButton1Click:Connect(function(clicked)
script.Parent.Name = minigames[i].Name
print(minigames)
if script.Parent.Debounce.Value == false then
script.Parent.Debounce.Value = true
game.Workspace.ChosenMinigame.Value = minigames[i].Name
m = Instance.new("Message")
m.Parent = game.Workspace
m.Text = "Someone has chosen " .. script.Parent.Name .. " as the next minigame!"
wait(3)
m:remove()
end
end)
end
end
end
end
Players.Zweiio.PlayerGui.thing.Frame.Padding.Setup:10: attempt to index nil with 'className'

1 comment
uh would if things[i]:IsA'TextButton' work