Custom .MouseButton1Pressed Function?

Alright, Here i am again, what im trying to do is when i create a TextButton, i want to apply a function to it.
so you can call the function from a other script. for example

local Button = Lib:new("Button")
Button.OnPressed:Connect(function()
     print("Clicked me!")
end)

Anyone knows how to do this? please let me know!

What?

Do you mean connecting it a function from other script?

Partially, I’m making a new instance using the library:New()
and then i am trying to connect it to a custom function,

You could use a module script, you can make functions inside it and make a script to use its module.

Could you send me a example of how the Modulescript would look like?

i at the moment return the Created Instance and all i’m getting is
Event is not a valid member of ImageButton

Do you mean like wrapping functions to instances as to have your own custom function? If so, I recall there was a resource in #resources:community-resources that detailed that

Exactly. what im trying to achieve is something Like RoStrap UI LIbrary with the rippleButtons. it has a simlar concept.

There’s a lot of resources related to the same thing about wrapping. Here are a few

2 Likes