I have a mana script and it increases by 15 ever couple of seconds but it has to reach 100 but sometimes if the number wont go up to 100 exactly it will go over 100. If someone can please tell me how to fix this it would be a huge help!
Here is the GUI Mana Script:
local bar = script.Parent.ManaFront
local manaText = script.Parent.ManaText -- Assuming you have a TextLabel named ManaText
local char = game.Players.LocalPlayer.Character
local hum = char:WaitForChild("Humanoid")
local maxMana = hum:WaitForChild("MaxMana")
local mana = hum:WaitForChild("Mana")
local function updateManaDisplay()
local change = mana.Value / maxMana.Value
bar:TweenSize(UDim2.new(change, 0, 1, 0))
manaText.Text = tostring(mana.Value) .. " / " .. tostring(maxMana.Value)
end
mana.Changed:Connect(updateManaDisplay)
maxMana.Changed:Connect(updateManaDisplay)
-- Initialize display
updateManaDisplay()
and here is what it looks like in game: