Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do I simply change a surface gui text on a brick with a script?

I'm actually pretty surprised of this issue. It would seem so simple but it just doesn't work, no errors either.

local text = script.Parent.Text

text = ('hello')

1 answer


Reference vs Value


when doing something like

local text = script.Parent.Text

it is essentially setting a variable equivalent to the text of the object, rather than actually being tied to the text of the object.

For that, you would do something like this:

local thing = script.Parent

thing.Text = "hello"

ik this goes without saying but, if this is a surface gui on the server, be sure to use a server script

Hopefully this helped!

2 comments

0

doesnt need to be a server script if its not connected to an event though, everyone will still see the same thing

0

not really, localscripts placed outside the client won't run, and network filtering will prevent everyone from seeing it if modified by a client

This discussion is preserved as it was. New answers, comments, and votes are closed.