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

How do i change what appears in the playergui on death?

I know you have to use something about player died or something but i don't know how to make it so that one GUI doesn't continuously clone back in the player gui because i have a script where it clones a gui when a player is added to the game.

Do i need to use something with characteradded or something im having troubles with player died

1 answer

✓ Accepted answer

If you want something to occur when someone dies, just use the Died event of a Humanoid.

If you clone are cloning a GUI and don't want it when a player dies, make sure it is being cloned when the Player joins the Players and not when the Character is added into workspace.

More events of the Humanoid can be found here.

game:GetService('Players').PlayerAdded:connect(function(player)
	--I would clone the GUI here, or just have it in the StarterGuis
	player.CharacterAdded:connect(function(character)
		character:WaitForChild("Humanoid").Died:connect(function()
			print(player.Name .. " has died!")
			--Anything else you want to happen can be here
		end)
	end)
end)

If I have helped answer your question please remember to accept my answer. Otherwise, feel free to message me or comment on my answer on how I could have better helped. Thanks!

2 comments

0

Ohh i see where i did wrong. Thanks alot for commenting, i was having problems with PlayerAdded and characteradded. This really helped :)

0

No problem. Best of luck.

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