Help With Conditions In A Table

  1. What do you want to achieve?
    I have a table with conditions in a table that check if 6 tool’s (the tool’s handles) positions match a 6 other parts; positions in the game. If the 6 tools’ positions match the 6 parts’ positions then when I click my button part it should turn transparent.

  2. What is the issue?
    The issue is that even though the 6 tool’s positions do not match the 6 part’s positions, my button part still goes transparent.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried to put the specific position coordinates like this "game.Workspace.Comic2Tool.Handle.Position == Vector3.new(x,y,z) instead but that didn’t change anything and the script worked the same way. BTW I am new to using tables/arrays so I’m not sure if I am doing this right!

local ClickDetector = script.Parent.ClickDetector

function onMouseClick(player)	
local Conditions = 
		{game.Workspace.Comic1Tool.Handle.Position == game.Workspace.ComicPlacement1.Position,
			game.Workspace.Comic2Tool.Handle.Position == game.Workspace.ComicPlacement2.Position,
			game.Workspace.Comic3Tool.Handle.Position == game.Workspace.ComicPlacement3.Position,
			game.Workspace.Comic4Tool.Handle.Position == game.Workspace.ComicPlacement4.Position,
			game.Workspace.Comic5Tool.Handle.Position == game.Workspace.ComicPlacement5.Position,
			game.Workspace.Comic6Tool.Handle.Position == game.Workspace.ComicPlacement6.Position}

	if Conditions then
		script.Parent.Transparency = 1
		print("Correct!")
	end
end
ClickDetector.MouseClick:Connect(onMouseClick)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Conditions is a table, isn’t nil, and thus is always true. You want this:

local condition = true

for _, istrue in pairs(Conditions) do
  if istrue == false then
    condition = false
    break
  end
end

I used this but my button part goes transparent when my tools positions DO NOT == the part’s positions. Do I have to change one of the true/false so it works when the positions do match?

You can reverse the istrue == false, or the comparison of “condition”.

It works but I still have the same issue, even when the tool’s positions don’t match the part’s positions like I put in the script the button part goes transparent and it should only go transparent on click if the positions match :confused: Im thinking of seeing if I can use something else instead of a table for all the conditions I want met for the function