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
How to Wrap Instances in a Script
When I started developing Wrapping Instances wasn’t easy for me in the beginning until I fully understood it. That is why I want to share this with the community.
First, before we can wrap an instance we need to know what wrapping is. Wrapping is a way to add additional properties to instances that are not already properties. For instance, there is a way to set a birth time property to an instance by using wrapping.
Prior Knowledge:
Before you start wrapping…
This is a tutoral on using metatables to create wrappers around Roblox’s locked objects, such as Instances and special data types. This gives you the freedom to change or add new functionality to the existing API. The following guide assumes you’re comfortable with Lua, particularly with metatables, and are familiar with the direction Roblox’s object-based scripting tends to go.
I’ll preface this with a disclaimer: This isn’t a very good idea. Using Roblox’s API the way it was intended helps wi…
Two articles have already covered this topic (link and link ), and they’re both good! But I wanted to approach this idea in my own way. A way that would feel nicer for beginners, especially those that have learned about metatables, and really couldn’t get their heads around how they’d use them. Which is why might need a good bit of knowledge about metatables and various of bits of object-oriented programming. Also, I’m gonna be digging deep to talk about more stuff.
First of all, what’s wrappin…
2 Likes