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

Minigame player death script help?

Hi, So I am working on a Minigame. I am stuck at the part of declaring who has won. I would like it to be many players that can win a round. I was thinking of some different ideas. One was to Change the players Team when they die. How would I detect when there is only one player left? If anyone has any ideas or can help me, please do so.

  • I am not asking for a request but for some guidance.

1 answer

Create a bool value in this script so the script can detect round is or is not in play(if you dont already have one)

local player = game.Players.LocalPlayer
local roundPlaying = script.RoundPlaying.Value -- Bool value
players = {}
dead = {}
won = {}
game.Players.PlayerAdded:connect(function()
	table.insert(players,{player.Character:FindFirstChild("Humanoid").Health})
end
if player.Character:FindFirstChild("Humanoid").Health == 0 then
	table.insert(dead,{player.Name})
	--Add change team here
end
if player.Character:FindFirstChild("Humanoid").Health ~= 0 then
	if roundPlaying == true then
	--Add stuff here
elseif roundPlaying == false then
	table.insert(won,{player.Name})
	--Add stuff here
	end
end

Idk if this will work, just going off the top of my head.

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