Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
oSyM8V3N 429 Moderation Voter
6 years ago

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

Log in to vote
1
Answered by 6 years ago
Edited 6 years ago

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!

0
Ohh i see where i did wrong. Thanks alot for commenting, i was having problems with PlayerAdded and characteradded. This really helped :) oSyM8V3N 429 — 6y
0
No problem. Best of luck. RockerCaleb1234 282 — 6y
Ad

Answer this question