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

How to clone gui when a player die?

Asked by
jnsan56 -31
5 years ago
game.Players.PlayerAdded:Connect(function(plr)
    local CloneMe = game.ServerStorage.ClassLoadout:Clone()
    CloneMe.Parent = plr.PlayerGui
end)

how do I make it when a player die it clone the gui

3 answers

Log in to vote
0
Answered by
gloveshun 119
5 years ago

Hi bro,

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterRemoving:Connect(function()
    local CloneMe = game.ServerStorage.ClassLoadout:Clone()
    CloneMe.Parent = plr.PlayerGui
end) end)

try this.

0
This runs BEFORE the character is removed. It's a much better solution to add this on CharacterAdded User#834 0 — 5y
Ad
Log in to vote
0
Answered by
VitroxVox 884 Moderation Voter
5 years ago

Hello dude, here this might be what you're looking for!

(It's a localscript which you should put in StarterGui)

local Player = game:GetService("Players").LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()

wait(0.25)

character["Humanoid"].Died:Connect(function()
    local CloneMe = game.ServerStorage.ClassLoadout:Clone()
    CloneMe.Parent = plr.PlayerGui
end)
Log in to vote
0
Answered by
harstud 218 Moderation Voter
5 years ago

This is probably not what you're looking for, but if you mean like when the player dies, the GUI doesn't disappear, go into the ScreenGUI's properties and turn ResetOnSpawn off.

Answer this question