Making a Detection Script for a Door

It says on your profile you have about 1.2 years of dev experience. You still, however, don’t know how to make a simple countdown script?

The room virtually is a rectangule with coordinates. How about creating a script that every, let’s say, 0.3 seconds checks coordinates of all the players in the game. And if a player’s coodinates fall withing the coordinates of the room, then your body-count can be counted as +1.
In the game you have to work out situation in case more than 12 players sneak in… what if 20?! Try to manage a queue system to detect who was the last… Just kill them HAHAHA if they sneak in.

Oh sorry about that i was AFK, From the thing i meant on 1.2 Years of Experience is on Building and Roblox Studio Methods.

made a similar design before and it doesnt take much at all
just use the zoneplus module if there are 12 players inside the zone you simply teleport
of course if you dont want more 12 people inside at once you can make the doors cancollide to true

1 Like

Can you send me a link to the Module?

its pretty simple to use just read the example inside the post and add the model to your place

1 Like

Don’t rely on RemoteEvents when you can just handle it all on the server;
because 9 times out of 10,they’ll be insecure and exploitable.

Use Region3, detect players within that region, add them to a table, if it matches your specific amount of players,
teleport them to the game.

You’ll also need to detect when they’re not within that region and adjust accordingly.

Just noticed somebody provided you a easy-to-use module, use that and read the usage.

Hm…It doesn’t have what I’m looking for.

erm…hehehehe, I do not know how to do that.

Region3 | Roblox Creator Documentation

Region3 (roblox.com) - has a code sample

1 Like

Hm…I didn’t see a code in there…

I looked into ZonePlus, it would be more than suitable for your needs.

Introduction - ZonePlus (1foreverhd.github.io)

1 Like
-- Assuming we place ZonePlus in ReplicatedStorage
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))
    -- do something
end)

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

local playersArray = zone:getPlayers() -- gets current players within zone, teleport them after a countdown

Not be nasty, but next time do a bit more research as not everyone is as nice as me. From what I’ve noticed, anyway. Take care and hope this helps!

1 Like

Thanks! Maybe i can modify it? Like in Doors?

Assuming it’s a Localscript?

When they touch the door, teleport them into the zone and then those events will help you work with the rest. (.playerEntered(), .playerExited())

Create a loop that constantly checks how many players are within the zone, if it matches the specific amount of players, do a for loop for a countdown and teleport the players to the specified place. You’d also want to add a check when a player leaves the zone mid-countdown; it is up to you if you let it continue or cancel.

No, a ServerScript. As it will be handled by the Server - well, you’d want it to be.

So it’s a Scripts in ServerScriptService, because of it’s handling the Server?

It is a ServerScript you would want to place in:

ServerScriptService

because you would want it to be handled by the server and not the client.

1 Like

So how do i make it Connect() to the Door Detectors?