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

What is the differences between the Touch event and Region3?

It seems like for both the touch and Region3, their purpose is to detect stuff. The question is, what are the major differences between the Touched event and Region3? And what are some practical uses for region3 itself, since it seems like I can just create a cube for my region and add in a touched event.

1 answer

Well, to put it as simple as possible, think of it like this:

Let's say we have a part and we want to be sure that when a player touches it, they die. We would use the touch event like so:

script.Parent.Touched:Connect(function(part)

end)

But why would we not use a Region3 for this case? Well, simply put, the .Touched event is great for detecting, if, well, something touched something. We wouldn't bother using Region3 for a couple of the following reasons:

  1. We are looking for collisions, not if something is in an area.
  2. .Touched is more suited for this scenario (the part is being touched).
  3. We aren't looking to process multiple objects. We are just looking for one.

However, let's take Jailbreak as an example. When robbing the bank, the game checks if players are in a certain area. Touched is no good in this use case, as it would just get when the player moves. In comes Region3.

Using the specific area, the Reigon3 checks every, let's say 1 second. Then, it gets all the players in the area given. It doesn't matter if they moved or not. They still get their well earned cash.

Hope this helped!

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