I’ve been looking for SO long but I can’t find my answer to the question. I’m not sure if I’m doing something wrong or if I’m missing something. Here is my code I have so far.
(Developer Relations, please don’t flag me again.)
local Models = {}
local ModelNames = {}
local ModelSpawnSystem = game.StarterGui.ModelSpawnSystem
local CloneButton = game.StarterGui.ModelSpawnSystem.ScrollingFrame.CloneButton
for _, v in pairs(game.ReplicatedStorage.Models:GetChildren()) do
table.insert(Models,v:GetExtentsSize())
table.insert(ModelNames, v.Name)
end
for i , v in pairs(ModelNames) do
local Clone = CloneButton:Clone()
Clone.Visible = true
Clone.Text = ModelNames[i]
Clone.Parent = CloneButton.Parent
Clone.Name = ModelNames[i]
end
for i, v in pairs(ModelSpawnSystem.ScrollingFrame:GetDescendants()) do
if v:IsA("TextButton") then
print("yes")
end
end
print(Models)
print(ModelNames)
connections aren’t stuck to loops, they’re connected to the object itself. if in a loop you make a connection for MouseButton1Click, it’ll exist until you disconnect it or delete the button and Lua auto disconnects it
for i , v in pairs(ModelNames) do
local Clone = CloneButton:Clone()
Clone.Visible = true
Clone.Text = ModelNames[i]
Clone.Parent = CloneButton.Parent
Clone.Name = ModelNames[i]
Clone.Activated:Connect(function()
-- code
end)
end
Okay, I’ve figured out the answer by putting a localscript in the textbutton itsself. Now I’ve just got to figure out how to make it communicate to the server.