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

How do you change a StringValue from a script?

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?

1 comment

0

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

2 answers

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'
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! :)

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