Looking for a value that matches the one i have

Hello, the title may be unclear but i’ll try to explain as clearly as possible.
so i have a value, no matter where it is ( for example inside the player’s Humanoid), and i want to see if it matches one of the values inside a folder in ReplicatedStorage. it seemed pretty complicated and I havent found anything on the dev forum or anywhere else. So im here asking for help!

Thanks in advance

You can just match the values of the ValueObject. For example, if you have two values, Value1 and Value2, you can just check using the condition Value1.Value == Value2.Value.

1 Like

there isnt just one Value tho. there should be more than 8 values inside that folder i mentioned

Oh I see, so maybe like this?
game.ReplicatedStorage:FindFirstChild(Value1.Name)

1 Like

i could maybe set the value’s name as the value it self- and then do

if Value1.Name == game.ReplicatedStorage.Folder:FindFirstChild(""..Value1.Name)
1 Like

I’m a little confused on to what you are asking. Do you mean match the value by name, type, or what the value actually is?

If name you can just use FindFirstChild() to see if there is a value with the same name in your folder. For type you can use typeof()to find the same type of value and for finding the same value of a Value Instance you can use the == operator. Pretty similar to what @DargoA said (except use a for loop).

3 Likes

Use for loops.


for i,v in pairs(folder:getchildren()) do
if intvalue.Value == v.Value then
--What ever you want to do if it equals a value
end
end

Feel free to ask if you don’t understand what the code does, or if you have a question

2 Likes

I thought of For Loops but didnt really know how i could use it in this case.
I tried that and it worked! Thank you!

2 Likes

No problem! Everyone here is here to help!

1 Like