Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

When I do x == y what does that compare?

local function IsEqual(X,Y)
	if X == XYthen
		print('Equal')
	else
		print('Not Equal')
	end
	
end

IsEqual(workspace.Baseplate,game.ServerStorage.Baseplate)

I never understood this cause I duplicated Baseplate from workspace and put it in serverstorage and it saids not equal

1 comment

0

Their locations in memory are different. If you can see and select the two different parts in the workspace, then they must not be exactly the same. Compare the specific properties you want to check, or write a comparison function which does a bunch if you have too many for that to be practical.

3 answers

Because they are both 2 different objects,they are the same properties wise, but thats it

What x == y is doing is asking "Do the variables x and y refer to the same object?" In your case, they don't, because the duplicate baseplate is a separate entity from the original baseplate.

You can have two parts, both called "Part", both coloured the same, both the same size, but they're still different entities.

What if x == y then does is it compares the two to see if their values are the same.

This discussion is preserved as it was. New answers, comments, and votes are closed.