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

How would I determine if a player survived?

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 comment

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.

1 answer

✓ Accepted answer

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

1 comment

0

thanks!

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