Hello I’m currently making a leveling system but this bar if not clamped goes past it since the numbers go as high as 2200. but if I clamp it it still looks like its at the end even if its halfway?
Script:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local leaderstats = player:WaitForChild("leaderstats")
local MaxXp = player:WaitForChild("MaxXP")
local level = leaderstats:WaitForChild("Level")
local Xp = leaderstats:WaitForChild("XP")
wait(1)
local progress = math.clamp(Xp.Value / MaxXp.Value, 0, .563) -- Keep between 0 and 1
script.Parent.Parent.Progress.Text = Xp.Value .. "/" .. MaxXp.Value
script.Parent.Size = UDim2.new(progress, 0, .037, 0)
Xp.Changed:Connect(function(value)
script.Parent.Size = UDim2.new(progress, 0, .037, 0)
script.Parent.Parent.Progress.Text = tostring(value) .. "/" .. tostring(MaxXp.Value)
end)
Why does comment says the opposite as to what it does?Im so confused now
It clamps numbers between 0 and 0.563 but comment says that it clamps between 0 and 1…???
What?
Oh yeah sorry about that orginally it was one but i changed it to .563 because thats the size I want to keep it in between or else it goes past. Plus I forgot to update the comment