This is a Admin UI Lib for game so I don’t have to create UI’s by hand and just only with code.
At the moment I have been trying to solve this bug for the past 20 minutes.
In my UI Lib I have a function called Lib.CreateButton(), as intended it creates a button inside the current section (Lib.CreateSection) . And in the UI Lib code I have it so it provides a Name, Description, and a Callback function. Upon clicking the button nothing appears to happen. I have added print checks to make sure its not skipping anything, I have also attempted to directly go to the button in the code without using a variable and still the button does not detect the MouseClick.
Another thing is that the entire UI Lib is inside 1 script. So there isn’t a way for me to mess up the parenting while coding.
The solutions I have searched for did not work. I have tried setting the ZIndex of the button higher then everything else. And even restarted studio. Yet it does not give any Error in console.
My code.
-- Folder goes inside the DragFrame in the script.
local NewFolder = Instance.new("Folder", Drag)
NewFolder.Name = tostring(NewTab.Name) -- there is a function called Lib.NewTab(Name)
-- Function to create the button
function funcSection.CreateButton(Name, Description, Callback)
local NewButton = ButtonFrame:Clone() -- there is a variable tied to the ButtonFrame template
NewButton.Name = tostring(Name)
NewButton.Button.Text = tostring(Name)
NewButton.Label.Text = tostring(Description)
NewButton.Parent = NewFolder
-- Button function (Here!)
NewButton.Button.MouseButton1Click:Connect(function()
print("Hello") -- Print Check
end)
end
Screenshots:
Video:
Sorry, if this was confusing to understand. This is my first post on Dev Forums. And I don’t have good grammar either so my apologies.
If there is anything else you need to diagnose this problem please tell me and ill send.