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

Touched's perimeter otherParts not work with if statement that compares perimeter with string?

game.workspace.Sell.sellpart.Touched:Connect(function(otherPart)
	if otherPart == "Food" then
		print("success")
	end
end)

This does not work at all ^. I it so when the part called "Food" touches the Sell.sellpart it becomes detected. When I do:

game.workspace.Sell.sellpart.Touched:Connect(function(otherPart)
	print(otherPart)
end)

It is able to detect parts. And it detects Food when that part touches the sellpart.

I have absolutely no idea what to do.

2 answers

After looking in the toolbox for a tycoon model and finding out how the tycoon's selling system worked, I found out this:

If you type in:

game.workspace.Part1.Touched:Connect(function(Part2)

end)

Then Part1 will look to see if it touched Part2.

So yeah don't do what I did. And also look at successful code first before you post onto a forum. Hopefully, I helped people avoid my own mistakes.

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