local ID = nosneaks
local MLGS = {"ihab123432gamer", "eleutherios", "Erik199875", "iiTHECOOLZ", "flyerbram002", "TrulyRev", "MrCrutuBringer"}
local GUIName = {"VSS", "SVD", "MainPicker", "Back2"} 

local function FindPlayer(Plr)
    for Num, Pler in pairs(MLGS) do
        if Pler == Plr then
            return true
        end
    end
end

game.Players.PlayerAdded:connect(function(Player)
    Player.CharacterAdded:Connect(function(character)
    if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(Player.UserId, ID) or FindPlayer(Player.Name) then
            for Num, TextButton in pairs(GUIName) do
                if game:GetService("ServerStorage"):FindFirstChild(TextButton) then
                    game:GetService("ServerStorage")[TextButton]:Clone().Parent = Player.PlayerGui.pickweap.Main:WaitForChild("RussianWeaps")
                end
            end
        end
        for Num, TextButton in pairs(GUIName) do
            if Player.PlayerGui.pickweap.Main.RussianWeaps:FindFirstChild(TextButton) == nil then
                if game:GetService("ServerStorage"):FindFirstChild(TextButton) then
                        game:GetService("ServerStorage")[TextButton]:Clone().Parent = Player.PlayerGui.pickweap.Main:WaitForChild("RussianWeaps")
                    end
                end
            end
        end)
    end)

this script gives people with a gamepass and some of my freinds a set of guis, this part works fine. But, as soon as they die, the gui doesn't appear. I know that this is because I used PlayerAdded, but I don't know how to change it to CharacterAdded, which I tried to add as you can see but the problem still persists. Please explain what I've done wrong and fix my script, I've never used MarketPlaceService before so I'm really new to this.

2 comments

0

Are you sure the GUI has ResetOnSpawn enabled? Maybe that could be the problem.

0

that's not what my script does, the gui is stored in serverstorage and when a player owning that gamepass joins, the gui is cloned and put into their playergui. it has nothing to do with reset on spawn.