I have made a script for the xp system/level system that work but I want if player get more value than the limit to level then the extra value will go to the xp that needed to level up and if the player level up the value of xp that needed/required to level up will change or increase if the player level up more.
Value system (gui) >
local player = game.Players.LocalPlayer
local xp = player:WaitForChild("Exp")
local level = player:WaitForChild("levels")
local maxExp = 100
xp.Changed:Connect(function()
if xp.Value >= maxExp then
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
wait(0.5)
xp.Value = 0
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
level.Value = level.Value + 1
else
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
end
end)
script.Parent.Size = UDim2.new(xp.Value/maxExp,0,1,0)
xp text script >
local player = game.Players.LocalPlayer
local xp = player:WaitForChild("Exp")
local maxExp = 1853970
script.Parent.Text = xp.Value..' / 100'
xp.Changed:Connect(function()
script.Parent.Text = xp.Value..' / 100'
end)
local player = game.Players.LocalPlayer
local xp = player:WaitForChild("Exp")
local maxExp = player:WaitForChild("MaxExp")
script.Parent.Text = xp.Value..' / 100'
xp.Changed:Connect(function()
script.Parent.Text = xp.Value..' / '..maxExp
end)
but when i join the game the gui become like this
and when i level up the gui become like this
the text doesn’t change to the value text that i have put