it says Health is not a valid member of Player whenever i click a brick which is supposed to kill you instantly whenever you click on it , heres the script :
script.Parent.ClickDetector.MouseClick:Connect(function(p) p.Health = 0 end)
The Health
property is a property of the Humanoid
, not the Player
instance itself. The humanoid is inside of the player's character, so you can access the Character
property and get the humanoid from there.
script.Parent.ClickDetector.MouseClick:Connect(function(p) p.Character.Humanoid.Health = 0 -- getting the character, the humanoid is in there. end)