Kinlei / MaterialLua

A material design library, designed for use in Roblox.
65 stars 76 forks source link

UI.Object:SetText(Text) #15

Closed Xowie89 closed 3 years ago

Xowie89 commented 3 years ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like A way to change the text of any UI element, buttons for instance (If there is already a way then more precise documentation of it as I cant figure out how to do it)

Describe alternatives you've considered I've tried many things but cant get anything to work (How does one manipulate the UI once it is created using your example script?)

Additional context You have:

local X = Material.Load({ Title = "ChibuHub", Style = 3, SizeX = 500, SizeY = 350, Theme = "Light", ColorOverrides = { MainFrame = Color3.fromRGB(235,235,235) } })

local Y = X.New({ Title = "Menu one" })

local A = Y.Button({ Text = "Kill All", Callback = function() print("hello") end, Menu = { Information = function(self) X.Banner({ Text = "This function can get you banned in up-to-date servers; use at your own risk." }) end } })

But I wanna change the text of A when the button is clicked. I looked through documentation and under returns there is a SetText() and GetText() but no explanation of how to use them. I tried A:SetText("NewText") but doesn't work.

Xowie89 commented 3 years ago

Solved by pre defining all the variables before defining the ui elements so they are local but not so local you cant change the ui within the callback.