My script is;
local player = game.Players.LocalPlayer local leaderboard = player:WaitForChild("leaderstats") local bar = script.Parent leaderboard:WaitForChild("xp") leaderboard:WaitForChild("maxXp") local maxXp = leaderboard.maxXp.Value local xp = leaderboard.xp.Value leaderboard.xp.Changed:Connect() bar.Size = UDim2.new((0.165/xp),0,0,25)
The size of the bar should be a fraction between the XP and the maximum XP. If 0.165 is the size of the whole bar, then it'd be:
bar.Size = UDim2.new((0.165*(xp/maxXp),0,0,25)