Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

why my rank does not change when i write this script?

Asked by 12 days ago

i trying to add rank system in the game, but the script that i write doesnt change the leaderstats value

game.Players.PlayerAdded:Connect(function(player)
    local stats = Instance.new("Folder", player)
    stats.Name = "leaderstats"

    local ilmu = Instance.new("IntValue", stats)
    ilmu.Name = "Ilmu"
    ilmu.Value = 0

    local kepintaran = Instance.new("IntValue", stats)
    kepintaran.Name = "Kepintaran"
    kepintaran.Value = 0

    local rank = Instance.new("StringValue", stats)
    rank.Name = "Rank"
    rank.Value = "Pemula"

    if player.leaderstats:FindFirstChild("Kepintaran").Value >= 20 then
        player.leaderstats.Rank.Value = "Pintar" --this is the script that i write
        end
    if player.leaderstats:FindFirstChild("Kepintaran").Value >= 5 then
        player.leaderstats.Rank.Value = "PelajarBaru"  --this is the script that i write
    end
end)

the same thing happen with my title script, it show "Pemula" billboard gui Rank whenever i join the game.

this is the script

local billboardgui = game:GetService("ServerStorage"):WaitForChild("BillboardGui")
local billboards = game:GetService("ServerStorage"):WaitForChild("Billboards")
local billboardgui1 = game:GetService("ServerStorage"):WaitForChild("BillboardGui1")


game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
        local cloneguis = billboards:Clone()
        cloneguis.TextLabel.Text = player.Name
        cloneguis.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
        cloneguis.Parent = game.Workspace:WaitForChild(player.Name).Head

        if player.Name ~= "BlackBooks" then
            if player.Name ~= "SleepInBlack" then
                print("Random Player")
            else
                    local clonegui = billboardgui:Clone()
                    clonegui.TextLabel.Text = "[Owner's Partner]"
                    clonegui.TextLabel.TextColor3 = Color3.fromRGB(255, 94, 94)
                    clonegui.Parent = player.Character.Head or player:WaitForChild("Character").Head
                end

        else
            local clonegui = billboardgui:Clone()
                clonegui.TextLabel.Text = "[Game Owner]"
                clonegui.TextLabel.TextColor3 = Color3.fromRGB(255, 0, 0)
            clonegui.Parent = player.Character.Head or player:WaitForChild("Character").Head
            end
        end)
    end)

game.Players.PlayerAdded:Connect(function(player) --the script start from here
    player.CharacterAdded:Connect(function(character)
        local k = player.leaderstats:WaitForChild("Rank")

        if k.Value == "Pemula" then
        local cloneguid = billboardgui1:Clone()
            cloneguid.TextLabel.Text = "Pemula"
            cloneguid.TextLabel.TextColor3 = Color3.fromRGB(0, 255, 0)
            cloneguid.Parent = player.character.Head or player:WaitForChild("Character").Head
            end
            if k.Value == "PelajarBaru" then
        local cloneguis = billboardgui1:Clone()
            cloneguis.TextLabel.Text = "Pelajar Baru"
            cloneguis.TextLabel.TextColor3 = Color3.fromRGB(204, 142, 105)
            cloneguis.Parent = player.character.Head or player:WaitForChild("Character").Head
        end
        if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 10995771) then
            local clonegui = billboardgui:Clone()
            clonegui.TextLabel.Text = "[ VIP ]"
            clonegui.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 0)
            clonegui.Parent = player.character.Head or player:WaitForChild("Character").Head
        end
        if k.Value == "Pintar" then
        local cloneguid = billboardgui1:Clone()
            cloneguid.TextLabel.Text = "Pintar"
            cloneguid.TextLabel.TextColor3 = Color3.fromRGB(213, 115, 61)
            cloneguid.Parent = player.character.Head or player:WaitForChild("Character").Head
            end
    end)
    end)

Answer this question