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

Level value isn't going up, how do I fix this?

Asked by 6 years ago

So I was just testing my game and whenever the EXP goes to 1000 it didn't change the level to 1 usually it would go to level 1 now its not.

Here's the script:

game.Players.PlayerAdded:Connect(function(plr)
    local stats = Instance.new("BoolValue",plr)
    stats.Name ="lstats"
    local currency1 = Instance.new("IntValue",stats)
    currency1.Name = 'Cash'
    local exp = Instance.new("IntValue",stats)
    exp.Name = 'EXP'
    local level = Instance.new("IntValue",stats)
    level.Name = 'Level'
     plr.CharacterAdded:Connect(function(character)
        character:WaitForChild("Humanoid").Died:connect(function()
            local tag = character.Humanoid:FindFirstChild("creator")
            if tag ~= nil then
                if tag.Value ~= nil then
                    local stats1 = tag.Value:WaitForChild("leaderstats")
                    stats1["Cash"].Value = stats1["Cash"].Value + 35
                    local stats2 = tag.Value:WaitForChild("leaderstats")
                    stats2["EXP"].Value = stats2["EXP"].Value + 125
exp.Changed:connect(function()
    level.Value = math.floor(exp.Value / 1000)
end)

                end
            end
        end)
    end)
end)
0
This isn't necessary when the variables don't change after the player dies. XP TheeDeathCaster 2368 — 6y

Answer this question