EDIT: I tried asking all of my friends. But there Offline. I got one friend to help, But he’s busy on School…So that’s why i’m forced to ask on DevForum.
You could add a touched event to the detector part, and have a variable keeping track of how many players are currently inside of the room. Once you have your minimum number of players, you could make a for loop that counts down and breaks when someone exits. To track exits, you could either have an exit button, or another part with a touched event.
Put a part in the middle of the room and put this script inside of the detection door.
local pos = (part in middle of room).Position
script.Parent.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
part.Parent:MoveTo(pos)
end
end)
You could have the touched event on the server and have it handle it. Depending on how you want to spread the workload, you could have it on the client and use remote events instead.
If you want to do it the easiest way, you could just put a part in where they stand when they enter and have the following code on the server.
local curPlayers = {}
local counting = false
local curNum = 30
function count()
for I = 1,30 do
if counting then
wait(1)
curNum -= 1
end
game.Workspace.partNameHere.Touched:Connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
local plr = game.Players:GetPlayerFromCharacter(part.Parent)
if plr ~= nil then
table.insert(curPlayers, plr)
-- Make an if statement to check if you need to run a function that starts the countdown.
end
end
end)
-- You could do something a bit like this on the server.
It is not the full script, but it is a start. It does go there. The current script will not properly function on its own, but I think you should look into it and see what you think the next step is. I am not making scripts for you, but I am giving you part of a script so that you can continue on with the basic start.
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.
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