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

Error keeps appearing that Health is a numbervalue ???

Ok so this serverscript is in serverscriptservice and when i play it, it keeps showing me this error saying that 18:58:50.980 - ServerScriptService.Script:18: attempt to index field 'Health' (a number value)

heres my script

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)

		
		 BillBoardGui = game.Workspace:WaitForChild(player.Name).Head:WaitForChild('BillboardGui')
		
		local ServerStorage = game:GetService("ServerStorage")
		
		
		
		local Red = BillBoardGui.REDNess
		
		local Green = Red.GreenESS
		
		
		local Hum = char.Humanoid
			
			Hum.Health.HealthChanged:Connect(function(HealthChanged)
				
							Red:TweenSize(UDim2.new(HealthChanged/Hum.MaxHealth,0,1,0))

		
			end)
	end)
end)

1 answer

✓ Accepted answer

HealthChanged is an event of humanoid.

So just do Hum.HealthChanged instead of Hum.Health.HealthChanged

1 comment

0

Also, if the answer is correct. Don't forget to accept his answer, it really helps answerers a lot!

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