This is in a normal script in the StarterGui Any ideas why I am getting this error?
attempt to index field 'Health' (a number value)
Code:
script.Parent.Parent.Character.Humanoid.Health.Changed:connect(function() if script.Parent.Parent.Character.Humanoid.Health == 0 then script.Parent.Parent.TeamColor = script.Col.Value script:Destroy() end end)
I hadn't had any problems with it up until recently :/
The Changed event is a part of the Humanoid, not of it's Health property.
Fix:
script.Parent.Parent.Character.Humanoid.Changed:connect(function() if script.Parent.Parent.Character.Humanoid.Health == 0 then script.Parent.Parent.TeamColor = script.Col.Value script:Destroy() end end)