Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Xp progress bar is not working?

Asked by 4 years ago

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)
0
You want one for an obey? iivSnooxy 248 — 4y
0
Obby* iivSnooxy 248 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

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)
Ad

Answer this question