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

How do you change a StringValue from a script?

Asked by 2 years ago

I saw another post on here about this, and the solution was to use something like this:

local StringValue = game.StringValue
StringValue.Value = "String"

instead of this:

local StringValue = game.StringValue.Value
StringValue = "String"

but this won't work on my script. It doesn't seem to be able to see the string value, even though I'm 100% sure it's there. I made sure I spelled it right and everything. How do you change a stringvalue from a script?

0
1 local StringValue = game.StringValue.Value 2 String.Value = "String" mkn00b 5 — 2y

2 answers

Log in to vote
0
Answered by 2 years ago

Make a stringvalue in a service but not game.

Let's say you put a stringvalue in replicatedstorage

You don't do game.StringValue

local stringv = game.ReplicatedStorage:WaitForChild('StringValue')-- i put waitforchild because replicatedstorage takes time to load.
stringv.Value = 'yes'

If you put it in Workspace, you do the same except referencing it differently

local stringv = game.Workspace.StringValue
stringv.Value = 'yes'
Ad
Log in to vote
0
Answered by
Punctist 120
2 years ago
local StringValue = Instance.new("StringValue")
StringValue.Parent = game:GetService("ReplicatedStorage")
StringValue.Name = "Anything you'd like."
StringValue.Value = "Hey, guys!"
--text before changing

wait(10)

--changed text after 10 seconds
StringValue.Value = "Your text"

You can use this example to make your own script work! :)

Answer this question