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

how would I go about making a system that shows all the people who died in a list?

Hey so I am trying to figure out how to make a list of people who died in a round. For the extra mods, I AM NOT REQUESTING A SCRIPT, I am just looking for an explanation. Like how would I go about it, what will I need to do. You don't need to leave a script, just a way to do it, I'll do the scripting myself.

1 comment

0

Use tables.

2 answers

Here's a guide.

(updated with more info)

Make a while do loop thing that runs when the round is running to start off. You may need to use remote functions / events on some parts of the script(s).

Whenever someone dies, it leaves a function like this:

game.Players.Noob.Character.Died:Connect(function()

Of course "noob" probably isn't going to join but that was an example.

Should do something like when a player gets added game.Players.PlayerAdded and in the function add the while loop and it always scans if the player dies WHILE the round is running.

Then the names should get added to a table and each username in the table gets added to GUI text labels that appear at the end of the round or something. Without tables your game can get sloppy.

If I should add more or if this is enough then let me know. Have a good day.

3 comments

0

I see where you are going but I am still alittle bit confused, can you go a bit more into detail?

0

I just clicked edit and spent like 5 Mins editing then accidentally clicked restore instead of save lol please wait a min.

0

K I added more info

This is my first time trying to give a semi-detailed answer so hopefully I'm a bit helpful.

In order to get a list of all the players that died we have to have a preset table within the match script.

playersDied =  {} -- Empty table awaiting names

Now adding on to what mud said, using the function that fires when a player dies, we can add the name to the table above.

playersDied =  {} -- Empty table awaiting names

game:GetService('Players').PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
		
		if not playersDied[player.Name] then -- check to see if their name is already there
		playersDied[player.Name] = player.Name  -- place name in table
		end
		
end
		end)
	end)
end)

Finally when retrieving a list of who died we can use a loop to check the names.

for i,v in pairs(playersDied) do
	print(v)
	end
playersDied = {} -- resets table after round is complete

Edit - You can also save a value to the table using:

table.insert(playersDied, player.Name)
or 
table.insert(playersDied, {name  = player.Name, deathtime = time}) -- additional values in the table.

1 comment

0

I know I'm really late but you're giving away the entire script which is probably what you are not allowed to do because this is not scriptingrequesters.org also like as he said "You don't need to leave a script, just a way to do it, I'll do the scripting myself."

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