Confused about i, v in pairs

This is my first time posting so I dont know if I posted this right so sorry if I didnt.

  1. What do you want to achieve?
    I have a folder with 8 Values and I want to see if one of the values matches “map” and then put map to true.
  2. What is the issue?
    It finds map and puts it to true but then immediately to false again.
  3. What solutions have you tried so far?
    Im new to using i,v in pairs so this is what I tried
for i,v in pairs(inventory:GetChildren()) do
	if v.Value == "map" then
		map = true
	else
		map = false
	end
end

Remove the else part of the condition. You only want to check if there is a value that matches “map”, otherwise it would reset to false after checking another value.

map = false
for i,v in pairs(inventory:GetChildren()) do
	if v.Value == "map" then
		map = true
	end
end

Have a good rest of your day.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.