Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this script in server script service not receiving the humanoids health?

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		local hum = char:WaitForChild("Humanoid")
		hum.HealthChanged:Connect(function()
			if hum.Health <= 50 then
				local info = TweenInfo.new(3)
				local tween = game:GetService("TweenService"):Create(hum,info,{Health=100})
			end
		end)	
	end)
end)

It only gets as far as to character added.

1 answer

✓ Accepted answer

I think you are misunderstanding this. When your character respawns, you start with 100 health and then it checks if the health is equal or lower than 50, but you have 100 health.

I think what you are trying to do is to make your health go back up when your health is below or equal to 50 right?

If so, you could use the Humanoid.HealthChanged event and check if the health is equal or below 50 each time it is fired and then do what you need to do.

3 comments

0

Thanks!

0

It's not working. I'll edit the post according to the new script.

0

Wait, it's working, i forgot to do Tween:Play()

This discussion is preserved as it was. New answers, comments, and votes are closed.