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

why i cannot change my stats value?

Asked by 12 days ago

I decided to make a rank system for my games. But i cannot change the Kepintaran.Value. Is it because it is a string or something else?

game.Players.PlayerAdded:Connect(function(player)
    game.Players[player.Name]:WaitForChild("leaderstats")
    game:GetService("Players")
    local kepintaran = game.Players[player.Name].leaderstats.Kepintaran.Value
    local rank = game.Players[player.Name].leaderstats.Rank.Value
    if kepintaran >= 20 then
         rank = "Pintar"
end
if kepintaran >= 5 then
    rank = "PelajarBaru"
    end
end)

this is my leaderstats script

local ReplicatedStorage = game:GetService("ReplicatedStorage")
    local Rebirth = ReplicatedStorage:WaitForChild("Rebirth")


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"

end)



Rebirth.OnServerInvoke = function(player)
    local requiredIlmu = player.leaderstats.Kepintaran.Value * 15 * 2 + 15
    if player.leaderstats.Ilmu.Value >= requiredIlmu then
        player.leaderstats.Kepintaran.Value = player.leaderstats.Kepintaran.Value + 1
        player.leaderstats.Ilmu.Value = 0

    end
end
0
is there any errors in the output? Jac_00b 6 — 12d
0
nothing Blackbooks 10 — 12d

Answer this question