I am trying to make a button that is cloned from a list of materials. I have the list down, but when I click the buttons, there is nothing that fires.
Cloning Script:
for i, v in pairs(materials) do
local ex = gui.MainFrame.FEFrame.Builder.Builder.Material.Frame.ScrollingFrame.Example:Clone()
ex.Parent = gui.MainFrame.FEFrame.Builder.Builder.Material.Frame.ScrollingFrame
ex.Name = v
ex.Text = v
ex.Position = UDim2.new(0,0,0,20*(i-1))
ex.Parent.CanvasSize = UDim2.new(0,0,0,(20*(i-1))+5)
ex.Visible = true
local newScript = script.Scripts.Script:Clone()
newScript.Parent = ex
newScript.Disabled = false
end
Materials: (Table)
local materials = {
"Plastic",
"Wood",
"Slate",
"Concrete",
"CorrededMetal",
"DiamondPlate",
"Foil",
"Grass",
"Ice",
"Marble",
"Granite",
"Brick",
"Pebble",
"Sand",
"Fabric",
"SmoothPlastic",
"Metal",
"Neon",
"Glass",
}
Cloned Script:
print("Started for "..script.Parent.Name)
local function Click()
script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.PluginScript.Events.ChangeMaterial2:FireClient(script.Parent.Name)
print("Trigger for "..script.Parent.Name)
end
script.Parent.MouseButton1Down:Connect(Click)
Plugin: https://web.roblox.com/library/2481663660/Brick-Builder

2 comments
You might need to check the path on Line 4 if that's correct. You should also fix that line to make it readable. If it's just a remote event you're firing then put it in ReplicatedStorage.
You shouldn't EVER need to have that many parents in a single line.