I’ve tried making this system where a list of imagebuttons in a scrolling frame are looped through, and have an event connected to it when clicked. When clicked it SHOULD change the text of certain instances.
The problem is, despite the imagebuttons existing, for some reason, the events straight up not fire.
I’ve tried beefing up the ZIndex and having the connected function be a coroutine that initiates the function, but it still doesn’t work. Any ideas on how I can fix this?
also note that this is a local script.
Here’s an excerpt from the code:
– tool_tip, gear_Name, gear_Icon, and type_Name are all instances that are changed
– weapons is a folder of tools
for _, mini_Slot in ipairs(scrolling_Frame:GetDescendants()) do
if mini_Slot:IsA("ImageButton") then
mini_Slot.Active = true
mini_Slot.ZIndex = 1000
local weapon = gears:FindFirstChild(mini_Slot.Name, true)
print(mini_Slot) -- this prints
local function on_Click()
print("clicked") -- and this doesn't
tool_tip.Text = mini_Slot.Name
gear_Name.Text = mini_Slot.Name
gear_Icon.Image = mini_Slot.Image
type_Name.Text = weapon:GetAttribute("Type")
tool_tip.Visible = true
gear_Name.Visible = true
end
mini_Slot.MouseButton1Click:Connect(on_Click)
end
end