Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I determine if a player survived?

Asked by 7 years ago

How would I determine if a player didn't die during a game round? (I'm making a round-based game and need to make a "survived players" system thingy whatever lol)

1
I would suggest putting all players inside a list and whenever a player dies, remove them from the list and check if that list has a length of 1. If that list does end up having a length of one, then you have your winner. Unfortunately, without an attempt, we can not make a script for you. M39a9am3R 3210 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

You need to add a boolValue of Whether the player survived the round or not. Make another script to tell this one when round ends.

Player = game.Players.LocalPlayer

Died = Instance.new("BoolValue",Player)

Died.Value = false
print("PlayerDied"..Died)

Character = Player.Character

print(Character)

Human = Character.Humanoid

print(Human)


Human.Died:connect(function(Dead)

    print("He died")
    Died.Value = true
end)

--make code here to signal end of round

if roundIsOver == true then
    if Died == true then
        print("Player Died")

     else
        print("PlayerSurvived")
    end
 end
Died = false  

Ps make sure its a LocalScript and in starter player scripts or it wont work

0
thanks! IfIWasntSoSwag 98 — 7y
Ad

Answer this question