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

How can I use a StringValue to find a name of another value?

How do I find a new value in game.ServerStorage.PlayerMoney PlayerMoney is a folder.

When a Player joins the game a NumberValue comes up named the Players name in the folder. And another stringValue named Owner which the Players name also will be putted in. What I need is to get the game.Workspace.Part.Owner.Value and search for that StringValue in the PlayerMoney folder.

I'm not good at Questions if this sounds like a "request" then try answer the best for help and not making. If not then just remove it or tell me to. (The full script is much longer that this is needed. The problem is that I don't know how to serach by a StringValue to a name in ServerStorage)

2 answers

You would have to use FindFirstChild() FindFirstChild finds a child of an object using a string that you would put as it's parameter. So for example, you would do workspace:FindFirstChild("Part") and it would be the same as workspace.Part.

In your instance, you would simply do PlayerMoney:FindFirstChild(game.Workspace.Part.Owner.Value)

I hope this helps!

1 comment

0

Remember that if there is no such child, FindFirstChild will return nil. workspace.Part or workspace["Part"] will give you an error.

is this what you mean?

local mystring = game.Workspace.Part.Owner.Value 
PlayerMoney[mystring]

Wiki Pages

Values

Operators

Do not forget to accept if it helped!

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