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)

1 comment

0

This isn't necessary when the variables don't change after the player dies. XP