I've been trying to create a leveling system using String Values. Basically, everytime you level up, you're given a new rank. E.g, Junior Manager, Manager, senior manager, etc.
game.Players.PlayerAdded:Connect(function(player)
local rank = Instance.new('StringValue', player)
rank.Name = 'Level'
rank.Value = 'Cadet'
rank.Parent = player
local exp = Instance.new('IntValue', rank)
exp.Name = 'Loyalty'
exp.Value = 0
local maxExp = Instance.new('IntValue', rank)
maxExp.Name = "Max"
maxExp.Value = 10
exp.Changed:Connect(function(val)
if exp.Value == 15 then
rank.Value = 'Private First Class'
exp.Value = 0
maxExp.Value = 20
elseif
exp.Value == 10 then
rank.Value = 'Private'
exp.Value = 0
maxExp.Value = 15
end
end)
end)
Essentially, the problem is that the value changes to 15 like the bottom part of code asks, but it resets everytime when it reaches 10 instead of 15 like I want it to. Visual of error. Because of this, the text label will not change to say "Private First Class". I receive no errors in the output, and I'm completely stumped, any help would be appreciated.

2 comments
hey buddy!, try usog exp.GetPropertyChanedSignal("Value") instead of exp.Changed!
That just breaks the script entirely