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

Help on finding if a player has died?

For this, I want it to check if one of the duelers have died.

But, I have no idea how to do this. Please help!

local gui = game.Workspace.Part1.v.z

function Fight()
	for i = 15, 0, -1 do
		gui.Text = "Intermission (0:"..i..")"
		if i <= 9 then
			gui.Text = "Intermission (0:0"..i..")"
		end
		wait(1)
	end
	gui.Text = "Now choosing dulers, (1 and 2)."
	wait(5)
	
	local plrs = game.Players:GetPlayers()
	local p1 = plrs [math.random(1, #plrs)]
	local p2 = plrs [math.random(1, #plrs)]
	
	repeat p2 = plrs [math.random(1, #plrs)] until p2 ~= p1
	
	gui.Text = p1.Name.. " and " ..p2.Name.. " have been chosen."
	wait(3)
	
	p1.Character:MoveTo(Vector3.new(147.5, 11.6, 15)) 
	p2.Character:MoveTo(Vector3.new(147.5, 11.6, -59))
	
	local sword1 = game.ServerStorage.Sword1:Clone()
	sword1.Parent = p1.Backpack
	
	local sword2 = game.ServerStorage.Sword2:Clone()
	sword2.Parent = p2.Backpack
	
	wait(2)
	
	for i = 30, 0, -1 do
		gui.Text = "Round, please wait (0:"..i..")"
		if i <= 9 then
			gui.Text = "Round, please wait (0:0"..i..")"
		end
		wait(1)
	end
	p1.Character:MoveTo(Vector3.new(190.2, 0.8, -25.6)) 
	p2.Character:MoveTo(Vector3.new(184.2, 0.8, -25.6))
end

while true do
	if game.Players.NumPlayers > 1 then
		wait(1.5)
		Fight()
	elseif game.Players.NumPlayers == 1 then
		gui.Text = "Waiting for 2 or more players."
	end
	wait()
end

1 answer

✓ Accepted answer

You could make a function that will fire when the Humanoid.Health value is 0. You could also use the died event to fire a function.

1 comment

0

Could you tell me how to do that?

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