so script is supposed to be working, everything works except it after exp hits the needed amount it wont level up, it just continues going, here is script: I apologize for bad english
local maxXp = 20
game.Players.PlayerAdded:Connect(function(player)
local levelinfo = Instance.new("Folder")
levelinfo.Name = "LevelsInfo"
levelinfo.Parent = player
local level = Instance.new("IntValue")
level.Name = "Level"
level.Value = 1
level.Parent = levelinfo
local exp = Instance.new("IntValue")
exp.Name = "Experience"
exp.Value = 5
exp.Parent = levelinfo
local xpNeeded = Instance.new("IntValue")
xpNeeded.Name = "expNeeded"
xpNeeded.Value = 20
xpNeeded.Parent = levelinfo
exp.Changed:Connect(function(newExp)
if exp.Value >= xpNeeded.Value then
level.Value += 1
exp.Value -= xpNeeded.Value
xpNeeded.Value = xpNeeded.Value + 2
end
end)
end)
the part which supposedly should be working is this:
exp.Changed:Connect(function(newExp)
if exp.Value >= xpNeeded.Value then
level.Value += 1
exp.Value -= xpNeeded.Value
xpNeeded.Value = xpNeeded.Value + 2
end
end)
I get no errors and nothing seems to be wrong with it, can someone tell me what to do?
I solved the issue, issue turned out to be that I was incerasing my exp from localscript and it was not replicated to server, I fixed issue and now everything works fine