How to compare two different tools?

Hello, in this post I would like to know how I can compare two tools, if the name of a tool is the same or if it is different, or if it is that tool.Name that I am looking for.

Example of this:

if tool.Name == "toolName" and tool.Name2 == "toolName2" then end

if tool.Name ~= "toolName" then end

How could you make these comparisons? any ideas?

hey i can help but my idea so … stupid
ok you can dublicate tool name this and put in teplecated storage and in script put this is inventory

do you mean if two tools have the same name?
if so then do this:

local tool = -- add here tool1
local tool2 = -- add here tool2
if tool.Name == tool2.Name then 
   print("same")
   -- do stuff here
end
2 Likes

oh ty! and how could I use the elseif in this case? to compare with a different tool

You could just simply check if tool.Name ~= tool2.Name, adding just another elseif statement if the original if statement didn’t return true

local tool = -- add here tool1
local tool2 = -- add here tool2
if tool.Name == tool2.Name then 
   print("same")
   -- do stuff here
elseif tool.Name ~= tool2.Name then
    print("different")
   -- do more and more stuff here
end

Of course, if you’d want to compare a tool with other tools you could reference it inside a table

1 Like

Oh! Thank you guys very much, you have helped me a lot, I think I had been confused with the whole process, thank you!

local String1 = "Hello"
local String2 = "Hello"

if String1:match(String2) then
	print(true)
else
	print(false)
end