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

Why is this string value not changing for every script?

Hello! I have a string value in Replicated Storage called 'Target' and it needs to be accessed by a server script. I use;

local Target = game.ReplicatedStorage.Target

In both scripts. It's changed in a script after a button is clicked and I used print to see if it really had changed, sure enough it returned the correct value after clicking the button. I then used the same print test in the server script and it could not find a value in Target at all. Are string Value's accessible? Have I set it up wrong? Should I use a WaitForChild()?

2 comments

0

I would recommend putting the value in workspace. Preferably in a folder in workspace.

0

Would that change anything?

1 answer

Well, when finding StringValues I usually use WaitForChild()

so try this;

If the script is in WorkSpace or ServerScriptService

local Target = game.ReplicatedStorage:WaitForChild("Target")
print(Target.Value)

This will print the Target's value and you would know if it actually changed or not,

3 comments

0

Thanks, but do you know why it isn't fetching the Target value in any script other than the one I set it in

0

What other script are you trying

0

The only one that somehow can access it is a localscript that can change the value. Any other script returns that value as nil

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