I'm not entirely sure if it's even a delay I need, but that's what I've summed the solution to.
So here's the situation: I've had this hand health-bar script I've used since forever. Made it a year or two ago and I've been using it multiple times. It's been good, up until now. I have a separate script that changes the MaxHealth and the Health (to 50) of a player when they push a button. My predicament is that it's not updating correctly and/or is over-shooting it's correct range. Another thing is when I change it the MaxHealth and Health to something over 100, it undershoots. The health values are correctly updating in the humanoid, it's just the GUI bein' a lil kooky.
Here's the script:
local player = game.Players.LocalPlayer player.CharacterAdded:connect(function(character) ---I tried adding a .05 delay here but it still didn't work local humanoid = character:WaitForChild('Humanoid') humanoid.HealthChanged:connect(function(health) if health > 0 and humanoid.Health <= humanoid.MaxHealth then --added the second statement to try and make sure it doesn't overshoot. doesn't do its job though script.Parent.Filling:TweenSize(UDim2.new((health / humanoid.MaxHealth), 0, 1, 0), "Out", "Quint", 0.2) else script.Parent.Filling:TweenSize(UDim2.new((health / humanoid.MaxHealth), 0, 1, 0), "In", "Quint", 0.2) end end) end)
I'm not trying to add a big delay as it will lag it and that looks bad in my opinion. Here's what the GUI is looking like: https://imgur.com/a/Nay2ljy