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

Script doesn't fire upon player's death?

Hello. So, this script is supposed to fire when it's player dies. It is stored in StarterGui, under a textbutton, which is in a screengui. In case that confused you, the hierarchy is: StarterGui > ScreenGui > TextButton > LocalScript The localscript should Delete a child of Player called MatchTag. It then needs to make a Gui visible for 5 seconds. Here's the script.

game.Players.LocalPlayer:WaitForChild("Humanoid").Died:connect(function()
	game.Players.LocalPlayer:FindFirstChild("MatchTag"):Destroy()
	script.Parent.Visible = true
	wait(5)
	script.Parent.Visible = false
end)

Thanks for the help!

2 answers

✓ Accepted answer
game.Players.LocalPlayer.Character:WaitForChild("Humanoid").Died:connect(function() -- you tried to find a humanoid in a player
    game.Players.LocalPlayer:FindFirstChild("MatchTag"):Destroy()
    script.Parent.Visible = true
    wait(5)
    script.Parent.Visible = false
end)

1 comment

0

Thanks!

`~~~~~~~~~~~~~~~~~ game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(chr) local humanoid = chr:FindFirstChild("Humanoid")

humanoid.Died:connect(function() plr:FindFirstChild("MatchTag"):Destroy() plr:WaitForChild("PlayerGui")....Visible = true -- define the ui object wait(5) plr:WaitForChild("PlayerGui")....Visible = false-- define the ui object end)

end) end)

`

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