so I have made this XP bar that works fine when it goes up but when I level up I want it to reset but I cannot for the life of me find out how, here is my script which is in a local script, any help is appreciated.
local player = game.Players.LocalPlayer
local EXP = player.leaderstats.EXP
local ReqEXP = player.leaderstats.ReqEXP
local level = player.leaderstats.Level
EXP.Changed:Connect(function(Changed)
if Changed then
script.Parent.expBar:TweenSize(UDim2.new(EXP.Value/ReqEXP.Value, 0, 1, 0))
end
end)
I was able to find a way to do it here is my script, it is located in a local script
local player = game.Players.LocalPlayer
local EXP = player.leaderstats.EXP
local ReqEXP = player.leaderstats.ReqEXP
local level = player.leaderstats.Level
EXP.Changed:Connect(function()
script.Parent.expBar:TweenSize(UDim2.new(EXP.Value/ReqEXP.Value,0,1,0),"Out","Sine",0.5,true)
end)
script.Parent.expBar:TweenSize(UDim2.new(EXP.Value/ReqEXP.Value,0,1,0),"Out","Sine",0.5,true)
EXP.Changed:Connect(function()
if EXP.Value >= ReqEXP.Value then
script.Parent.expBar:TweenSize(UDim2.new(0, 0,1, 0))
end
end)