When someone touch the part, they won't die. The one that doesn't touch it will die

Hello
So I want to make if someone touch the part that mean they are safe.
And for those who doesn’t touch the part after 60 seconds will die
This is for a story game!

Can you make it more Understandable? I just don’t understand when you say about part too much.

Okay, So I want to make it if someone touch the part at the end of the obby, the player wont ded. After 60 seconds, if they dont touch the part then they will ded. That’s it!

Also Speaking of Script Support, Did you bring a Script so we can help? Becuase it looks off-topic for Script Support.

I dont have any idea what the script could be, because this is like a complementary case and I dont know how to do it

We are not here to feed u scripts, do it yourself, if u get errors u can come here. U can also ask what will u need to do it for example remotes etc

Start by collecting all players in game in a table. If they touch the part, remove their name. At the end of the timer, kill everyone left in the table.

1 Like

Making a part whitelisting players to not get killed is more complicated.

First, add a script inside the part, and and a touched event. If the parent has a humanoid, then put their name inside a table.

Use a for loop and loop through the workspace. Kill the rest that is a player. Tell the script to check if the object has a humanoid and their name is not listed in the table.

1 Like

Ah, Okay then. you can leave this support, I will try to do it myself first then I will come back when I have any idea. Thank you!

Okay, Thanks for your guide. I will try to code it!

This version would kill people who just join. My version would ignore new players. Pick your poison, I suppose!

Um, Im sure his Idea will work. we can make it sothe event will active after the dialogue and then wait 60 seconds, there wont be any person that will join in the middle of a story game

1 Like

Yeah, if you already have a set player list, there should be no issues about offing newly joining players.

1 Like

Here is an example, you will have to obviously modify it to your preference.

local Players = game:GetService("Players")
local Part = workspace.Part
local Whitelist = {}

Part.Touched:Connect(function(hit)
    local Player = Players:GetPlayerFromCharacter(hit.Parent)
    
    if Player and not table.find(Whitelist,Player) then
        table.insert(Whitelist, Player)
    end
end)


while task.wait(60) do
    for _, Player in ipairs(Players:GetPlayers()) do
        if not Whitelist[Player] then
            if Player.Character and Player.Character.Humanoid.Health > 0 then
                Player.Character.Humanoid.Health = -1
            end
        end
    end
end
1 Like

Thanks you so much for your help, I will try it!

It’s working! Thank you so much for your help!

1 Like

My bad try again

local Players = game:GetService("Players")
local Part = workspace.Part
local Whitelist = {}

Part.Touched:Connect(function(hit)
    local Player = Players:GetPlayerFromCharacter(hit.Parent)
    
    if Player and not table.find(Whitelist,Player) then
        table.insert(Whitelist, Player)
    end
end)


while task.wait(60) do
    for _, Player in ipairs(Players:GetPlayers()) do
        if not table.find(Whitelist,Player) then
            if Player.Character and Player.Character.Humanoid.Health > 0 then
                Player.Character.Humanoid.Health = -1
            end
        end
    end
    Whitelist = {}
end
1 Like

It’s now working perfectly, Thanks you so much SelfDeclared!

1 Like