How can I know if a player is in a room?

I’m making a spookie game and am unsure what the best way to tell what room a player’s character is in.

You’ll need to use Region3.

2 Likes

Is there a more detailed post on regions? like ones with example and ways you can use it?

No, but you can search up YouTube videos.

or use a part size as the room and when it touched by a player’s humanoid or parts then the player is on the room
if the humanoid or the part is not a player character’s property children then you can use the GetPlayerFromCharacter()

1 Like

I know touch events are not always the most reliable are are regions better?

You shouldn’t use any of them. TouchEnded event has some blemishes like not firing when the player respawns, also Region3 functions are deprecated, they got replaced with Overlap functions.

Here’s an official topic which explains its usage in a simple way: Introducing OverlapParams - New Spatial Query API

2 Likes

You can use ZonePlus:

ZonePlus

local Zone = require(game:GetService("ReplicatedStorage").Zone)
local container = workspace.SafeZoneContainer
local zone = Zone.new(container)

zone.playerEntered:Connect(function(player)
    print(("%s entered the zone!"):format(player.Name))
end)

zone.playerExited:Connect(function(player)
    print(("%s exited the zone!"):format(player.Name))
end)

So half hitbox parts for each room and if a player is in that hitbox then they are in that room? Ok, I think this is the solution, but I must go to bed. I will try this tomorrow and mark this as a solution once I get it to work.