I have this piece of code and for some reason it kinda starts off good. And then after about 10 requests it stops updating the EXP and then bumps the player up to 100. Then to some random number over the rainbows.
It would be very nice for you to help, Radio
local player = script.Parent.Parent.Parent.Name
script.Parent.STATS.Parent = game.Players[player]
local LVLStats = game.Players[player]
local EXP = LVLStats.EXP
local LVL = LVLStats.LVL
local Gui = script.Parent
local Glvl = Gui.LVL
local Gexp = Gui.EXP
local MaxEXP = LVLStats.MAXEXP
local bEXP = Gui["EXP-BG"]["EXP-BAR"]
local NewEXP
EXP.Changed:connect(function ()
NewEXP = EXP.Value
if NewEXP >= MaxEXP.Value then
if LVL.Value == 100 then
bEXP.Size = UDim2.new(0,0,10)
wait(0.001)
Glvl.Text = "Level 100"
Gexp.Text = "0/"..MaxEXP.Value
else
bEXP.Size = UDim2.new(EXP.Value/MaxEXP.Value,0,0,10)
wait(0.001)
LVL.Value = LVL.Value + 1
if NewEXP >= MaxEXP then
EXP.Value = NewEXP - MaxEXP.Value
else
EXP.Value = MaxEXP.Value - NewEXP
end
MaxEXP.Value = MaxEXP.Value + 79
Glvl.Text = "Level "..LVL.Value
Gexp.Text = EXP.Value.."/"..MaxEXP.Value
end
else
bEXP.Size = UDim2.new(EXP.Value/MaxEXP.Value,0,0,10)
wait(0.001)
EXP.Value = NewEXP
Glvl.Text = "Level "..LVL.Value
Gexp.Text = NewEXP.."/"..MaxEXP.Value
end
end)
