Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Or2no 30
4 years ago

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

Log in to vote
0
Answered by 4 years ago

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!

0
doesnt need to be a server script if its not connected to an event though, everyone will still see the same thing Gameplayer365247v2 1055 — 4y
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 theking48989987 2147 — 4y
Ad

Answer this question