For some reason this error comes up any help? attempt to index upvalue 'Xpn' (a number value)
local plr = game.Players.LocalPlayer
local Xp = plr:WaitForChild("XP") -- Using WaitForChild() so the script won't break if "XP" has not loaded yet.
local lvl = plr:WaitForChild("lvl")
local Xpn = plr:WaitForChild("XpNeeded") -- How much more xp does a person need
lvl.Changed:Connect(function()
if lvl.Value == 2 then -- How much Xp needed will get updated
Xpn = Xpn.Value+50
end
end)
lvl.Changed:Connect(function()
if lvl.Value == 3 then -- How much Xp needed will get updated
Xpn = Xpn.Value+75
end
end)
lvl.Changed:Connect(function()
if lvl.Value == 4 then -- How much Xp needed will get updated
Xpn = Xpn.Value+100
end
end)
lvl.Changed:Connect(function()
if lvl.Value == 5 then -- How much Xp needed will get updated
Xpn = Xpn.Value+125
end
end)
Xp.Changed:Connect(function()
if Xp.Value >= Xpn.Value then
Xp.Value = Xp.Value-Xpn.Value
lvl.Value = lvl.Value+1
end
end)`

1 comment
heh that looks like a lvl up script I made