-
What do you want to achieve? A stats UI script that displays the players current stamina level.
-
What is the issue? The script works fine the first time, then stops working the second time after the player resets. (don’t mind my horrible lag in the video
my laptop decides to not work with the screen recorder)
Streamable -
What solutions have you tried so far? I’ve tried looking for similar topics and changing my code but nothing has worked yet.
Here’s the script
local TweenService = game:GetService("TweenService")
local player = game.Players.LocalPlayer
local character = player.Character
local Gui = script.Parent.Energy
local energy = character:GetAttribute("Energy")
local max = character:GetAttribute("MaxEnergy")
while true do
task.wait()
local energy = character:GetAttribute("Energy")
local max = character:GetAttribute("MaxEnergy")
local percent = math.floor((energy/max)*100)/100
TweenService:Create(Gui, TweenInfo.new(1,Enum.EasingStyle.Quad), {Size = UDim2.new(percent,0,0.625,0)}):Play()
end
all help is appreciated