I'm not sure what is going on what so ever. (I'm new to coding so excuse the messiness) Ok so, I have a health bar that decreases according to a dummy's health. For some reason, it is always laggy and never consistent. It also breaks every now and then. Here is my code for the dummy health bar.
wait (.1)
local visible = script.Parent.Parent.Parent.Visible
local bframe = script.Parent.Parent.Parent.Parent
while true do
local hp = game.Workspace.Dummy.Humanoid.Health/500
script.Parent:TweenSize(UDim2.new(hp,0,1,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.15)
wait (0.1)
if hp < 0.001 or hp == 0 then
bframe.BaseFrame.Visible = false
wait (7)
bframe.BaseFrame.Visible = true
script.Parent:TweenSize(UDim2.new(0,647,0,70))
script.Parent:TweenSize(UDim2.new(hp,0,1,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.15)
local hp = game.Workspace.Dummy.Humanoid.Health/300
script.Parent:TweenSize(UDim2.new(hp,0,1,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.15)
end
wait (.2)
end
if you need more code anywhere let me know. Also here is a link to my game so you can just see for yourself what happens.
https://www.roblox.com/games/659823610/Game-Tester#!/about
thank you, and sorry about how messy the code is. I just need to figure out what is happening for some reason.

1 comment
Holy moly wow thank you so much. That is way smaller than my code.