Default Health Not Updating When Script Damages or Heals Health

Hello Developers,

I have been messing around with scripts that heal and damage a players health. But, it seems when I do this the default overhead Roblox healthbar doesn’t seem to change when the player gets healed or damaged. I don’t know if its my scripts or not, but can I get some help with fixing this?

Video:

Damage Script:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

wait(5)

while true do
	wait(1.25)
	humanoid:TakeDamage(4.9)
end

Heal Script:

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")
local clickdetector = game.Workspace.HealButton.ClickDetector

clickdetector.MouseClick:Connect(function()
	humanoid.Health = 100
	wait(5)
end)

Thanks for the help,

Ultan

1 Like

This happens from time to time to me. It’s usually just a studio problem, using it in a actual server should work fine though.

both of my damage and heal scripts are local scripts, my bad should of just put it in the main post

Ok then I retract my statement > You can only mess with the humanoids health in server scripts. Local will only show for you.

Don’t use local scripts for damaging players, your script will be prone to exploiters. If the damage script is local, I don’t even understand how the damage is being replicated on the other client.

It would only be possible if he was using remote events and doing fireallclients > but hes clearly not here so nothing is happening lol.

Yes, I realised that after a second watching the video. Which is why I can’t understand, if the scripts are local, how the damage is being replicated.

I appreciate the help thx guys

Well what hes doing is looping on a local script taking damage away for all players > so everyones seeing the same thing on their screen, but its just not showing for the other people is what that is.