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

Individual Player StarterGuis?

Asked by 9 years ago

I would like to know if it is possible to create GUIs that don't reset upon death. I want only certain GUIs to stay while the others are deleted. I can't provide a script because I don't even know if this is possible and I don't know where to start. However, I do know how to disable GUI resets:

game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

The problem with this is that it disables ALL GUI resets. If you can answer this, it'd be great. Thanks in advance!

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

A way to get around this is by parenting the gui into ServerStorage when the client dies, then when they load again clone the gui back into their PlayerGui.

Example;

local gui = game.ServerStorage.GuiToClone

game.Players.PlayerAdded:connect(function(plr)
    local newGui = gui:Clone()
    newGui.Name = plr.Name.."'s Gui"
    newGui.Parent = plr.PlayerGui
    plr.CharacterAdded:connect(function(char)
        local presentGui = plr.PlayerGui:FindFirstChild(plr.Name.."'s Gui)
        if not presentGui then
            local gui = game.ServerStorage:FindFirstChild(plr.Name.."'s Gui)
            if gui then
                gui.Parent = plr.PlayerGui
            end
        end
        char.Humanoid.Died:connect(function()
            plr.PlayerGui:FindFirstChild(plr.Name.."'s Gui").Parent = game.ServerStorage
        end)
    end)
end)
Ad

Answer this question