local vault = game.ReplicatedStorage:WaitForChild("VAULTING")
vault.OnServerEvent:Connect(function(plr, Processed)
local stamina = plr.Settings.MaxStamina.Value
local vaulting = true
local Bar = plr.Stamina.Bar
if stamina > 0 and vaulting then
local newStamina = stamina - 100 -- Decrease stamina by 100
plr.Settings.MaxStamina.Value = newStamina -- Update the player's stamina
-- Update the bar size based on the new stamina value
Bar.Size = UDim2.new(newStamina / plr.Settings.MaxStamina.Value, 0, 1, 0)
if newStamina <= 0 then
vaulting = false
Bar.Size = UDim2.new(0, 0, 0, 0) -- Reset the bar size if stamina is depleted
end
end
end)
Also:
Make so that plr.Settings.MaxStamina.Value correctly represents the player’s current stamina and not the maximum stamina capacity. If it’s meant to be the maximum capacity, you’ll need a separate attribute or variable to track the current stamina level you have