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

String values to locations?

Asked by
1N0body 206 Moderation Voter
8 years ago

So let's say I have string value named "val". And in this value it's stored a location given by another script with :GetFullName(). Now my question is, how could another script read this value and ACCESSthat location. Example: Script 1:

val = game.Workspace.StringValue
    val.Value = script.Parent:GetFullName() -- We got the location of the scripts parent
Script 2: 
-- this scripts job is to access that location.
    val = game.Workspace.StringValue
-- now what? We can read the value but how am I gonna tell the script that the value is the location?

1 answer

Log in to vote
1
Answered by 8 years ago

Don't

There's even a note on the Wiki if I remember correctly, noting that if you find yourself parsing this value then you're doing something very wrong. What you want to do instead is use an ObjectValue, and just set the value to script.Parent, so that val.Value is exactly what you meant it to be.

0
Thanks, I didn't even know about object values 1N0body 206 — 8y
Ad

Answer this question