If statment doesnt work but its condtion is met

  1. What do you want to achieve?
    i want the if statment to check if the value = item

  2. What is the issue?
    it doesnt do even if its conditon is met

  3. What solutions have you tried so far?
    tried to print to see the issue and as it turns out the if statment doesnt allow the script to run as intended

local check = script.Parent.Open
local stuff = {"MysteryClick", "DeathClick"}
local page = game.Players.LocalPlayer.PlayerGui.ShopGui.Pages.OwnedItemsPage

check.Changed:Connect(function(value)
	local items = game.Players.LocalPlayer.ToolFolder:GetChildren()
	if value == true then
		for index , Value in ipairs(items) do
			print(Value)
			for num , item in ipairs(stuff) do
				print(item)
				if Value == item then
				if Value.Value == true then
                page:FindFirstChild(item).Visible = true
					end	
					end
				end	
			end
	end
end)

by the way i check if the item and value are the same by printing and they are but the if statment still doesnt allow it

i know that value and Value are diffrent in lua and thats what i basically did

Your if statement is checking if the value passed to the function is equal to “true”, but as @GRADE_1000 said, the value that’s passed is the name of the property, not a boolean that is true or false. In this case, you’d probably want to use “if check.Value == true” or even “value.Value == true” (if the variable passed is a pointer and not just a string) instead of “if value == true”

1 Like

oh i meant this line by the way
if Value == item then
sorry

You are trying to compare an instance to a string, so just do if value.Name == item then

1 Like