Unable to assign property Text. string expected, got nil (for plugin:getSetting())

Hello, I was trying to assign Text to a plugin:getSetting() value, but Unable to assign property Text. string expected, got nil error showed up. I wonder what went wrong.


Script:

local WELCOME = "WELCOME"
Welcome.Input.Text = plugin:GetSetting(WELCOME)

This is just a concept of a script, but works exactly the same way.


Thanks!

The error tells you exactly what went wrong. The value you tried to assign to the text property is nil, so the result of plugin:GetSetting(WELCOME) was nil.

How would I fix that, as I did set it to "WELCOME"?

Just because the input value of the function was a string, doesn’t mean the output value must be. Check the documentation, it should tell in what case the function would return nil.

Try this maybe?

Welcome.Input.Text = plugin:GetSetting("WELCOME")

Busy rn

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.