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

needing help for a rank system, it won't change the billboard gui (?)

Asked by
IPmist 0
3 years ago

whenever the character ranks up, the previous rank's billboardgui is supposed to dissapear.

but it doesn't

when someone ranks up, it actually ranks up but leaves the "novice" tag in the background even after you rank up AGAIN.

what am i doing wrong?

here's my script:

game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(char) local leaderstats = player:WaitForChild("leaderstats") local CheckValue = leaderstats:WaitForChild(script:WaitForChild("leaderstats").Value)

if CheckValue.Value >= 0 and CheckValue.Value < 5 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

         if not char:WaitForChild("Head"):FindFirstChild("Rank") then
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Novice"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 5 and CheckValue.Value < 10 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Apprentice"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 10 and CheckValue.Value < 15 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Initiate"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 15 and CheckValue.Value < 20 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Journeyman"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 20 and CheckValue.Value < 25 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Adept"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 25 and CheckValue.Value < 30 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Expert"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 30 and CheckValue.Value < 40 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Master"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 40 and CheckValue.Value < 50 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Grandmaster"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

elseif CheckValue.Value >= 50 and CheckValue.Value < 60 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Legendary"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

end

CheckValue.Changed:Connect(function() if CheckValue.Value >= 0 and CheckValue.Value < 5 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Novice"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 5 and CheckValue.Value < 10 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Apprentice"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 10 and CheckValue.Value < 15 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Initiate"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 15 and CheckValue.Value < 20 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Journeyman"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 20 and CheckValue.Value < 25 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Adept"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 25 and CheckValue.Value < 30 then

        if char:WaitForChild("Head"):FindFirstChild("Rank") then
            wait(3) 
            char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

        if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
            local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Expert"):Clone()
            b.Name = "Rank"
            b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 30 and CheckValue.Value < 40 then

            if char:WaitForChild("Head"):FindFirstChild("Rank") then
                wait(3) 
                char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

            if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
                local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Master"):Clone()
                b.Name = "Rank"
                b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 40 and CheckValue.Value < 50 then

            if char:WaitForChild("Head"):FindFirstChild("Rank") then
                wait(3) 
                char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

            if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
                local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Grandmaster"):Clone()
                b.Name = "Rank"
                b.Parent = char:WaitForChild("Head")
        end

        elseif CheckValue.Value >= 50 and CheckValue.Value < 60 then

            if char:WaitForChild("Head"):FindFirstChild("Rank") then
                wait(3) 
                char:WaitForChild("Head"):WaitForChild("Rank"):Destroy()    
        end 

            if not char:WaitForChild("Head"):FindFirstChild("Rank") then                
                local b = game.ServerStorage:WaitForChild("Ranks"):WaitForChild("Legendary"):Clone()
                b.Name = "Rank"
                b.Parent = char:WaitForChild("Head")
        end



        end
    end)
end)

end)

0
please keep all the code within the code tags. this post is hard to read in its current state NinjaManChase 226 — 3y

Answer this question