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

Okay, so how would I see if there is ONLY ONE player in an area?

I honestly have no clue how. The area is a part, where when only one player left is in it then the script will show a gui.

2 comments

0

May I ask what this is for?

0

well, I have been having trouble with this game (it's like a last man standing thing) and in the arena, which is a part, the players battle it out. I want to make a code that determines if there is only one player in the area, then show a GUI that says the players name.

1 answer

Simple, we will use GetTouchingParts.

example of use:

local onlyPlayer = false -- only one player bool value

for i,v in pairs(script.Parent:GetTouchingParts()) do
       if i == 1 then
          onlyPlayer = true
           else
           onlyPlayer = false
        end
end

1 comment

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