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

GUI giver script does not work after player has died?

Asked by 5 years ago

This code is used for cloning a GUI into the player if the player does not have it already, and also opens the GUI. It will clone the GUI into the player the first time they come into contact with the block but after they die, if they touch the block again it will not clone the GUI.

script.Parent.Touched:connect(function(p)
    local player = game.Players:GetPlayerFromCharacter(p.Parent)
    if (player) then
        if (not player.PlayerGui:FindFirstChild("SpawnGUI")) then
            local GUI = game:GetService("ServerStorage").SpawnGUI:Clone()
            GUI.Regen.Value = script.Parent.Parent.Pos
            GUI.Parent = player.PlayerGui
        else
            player.PlayerGui.SpawnGUI.BG.Visible = true
        end
    end
end)

1
as this is a gui giver I would do this in a local script and just clone from replicated storage. I am not sure whe this is not working. User#5423 17 — 5y

Answer this question