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

gui only cloning once when it can clone multiple times?

Asked by
Donut792 216 Moderation Voter
6 years ago

alright so in my game this is my levelup handler which when someone levels up it is supposed to clone a gui into their PlayerGui which it does fine the first time but after they level up again nothing, i have no idea why it would just quit after one clone

script:

game.Players.PlayerAdded:Connect(function(player)
    local requirements = player:WaitForChild("Requirements")
    local levelrequirement = requirements.RequiredKills
    local leaderstats = player.leaderstats
    local kills = leaderstats.Kills
    local level = leaderstats.Level
    local levelupgui = game.ServerStorage.LevelUp:Clone()
    kills.Changed:Connect(function()
        if kills.Value >= levelrequirement.Value then
            print(player.Name.." Leveled Up")
            level.Value = level.Value + 1
            levelupgui.Parent = player.PlayerGui
            wait(5)
            levelupgui:Destroy()
            if level.Value >= 5 then
            levelrequirement.Value = levelrequirement.Value + 20
            else
            levelrequirement.Value = levelrequirement.Value + 15    
            end
        end
    end)
end)
0
Try directly referencing the levelupgui through playergui instead of how you're doing it here. Or when it happens, check ingame and see if the gui is still in server storage. DinozCreates 1070 — 6y
0
it was still in the server storage so ill try directly referencing it but since the server cant see a clients PlayerGui idk if that will work but i will try it Donut792 216 — 6y
0
ok no that did not work Donut792 216 — 6y
0
yeah if it was still in storage no point. worth a shot. \ DinozCreates 1070 — 6y

1 answer

Log in to vote
0
Answered by 5 years ago

Im not sure if you resolved this but try by changing 'levelupgui:Destroy()' to 'levelupgui:Remove()' once again you probably resolved this anyway

0
Remove will do the same as Destroy its just deprecated so noone likes it Donut792 216 — 5y
0
Have you figured this out yet? NFStudios 0 — 5y
Ad

Answer this question