of     1   

CyberHusky88
#46179826Monday, April 25, 2011 9:41 PM GMT

I run the script but it keeps saying in output: Humanoid is not a valid member of Hat: local FF = script.Parent function Poked(hit) if hit.Parent.Humanoid ~= nil then hit.Parent.Humanoid:TakeDamage(5) FF.Transparency = 0.5 for i = 0,5 do FF.Transparency = FF.Transparency + 0.1 wait() end elseif hit.Parent.Humanoid == nil then FF.Transparency = 0.5 for i = 0,5 do FF.Transparency = FF.Transparency + 0.1 wait() end end end FF.Touched:connect(Poked)
ServerLabs
#46180202Monday, April 25, 2011 9:47 PM GMT

Is there a humanoid in the hat, or in the hat's parent?
CyberHusky88
#46180857Monday, April 25, 2011 9:56 PM GMT

It's when I walk into it, I just happen to be wearing a hat and I really don't want to remove everyone's hats on entry
CyberHusky88
#46181948Monday, April 25, 2011 10:11 PM GMT

bump
ServerLabs
#46193928Tuesday, April 26, 2011 12:49 AM GMT

Lol, I see the problem. There is a part inside the hat, the hat isn't necessarily touched, but the part is. Use hit.Parent.Parent instead.
CyberHusky88
#46201913Tuesday, April 26, 2011 2:43 AM GMT

No, I put if hit.Parent.Humaniod ~= nil then --Stuff-- elseif Hit.Parent.Humaniod == nil then --stuff-- end
NewFissy
#46202806Tuesday, April 26, 2011 3:04 AM GMT

local FF = script.Parent function Poked(hit) if hit.Parent:FindFirstChild("Humanoid") ~= nil then hit.Parent.Humanoid:TakeDamage(5) FF.Transparency = 0.5 for i = 0,5 do FF.Transparency = FF.Transparency + 0.1 wait() end else FF.Transparency = 0.5 for i = 0,5 do FF.Transparency = FF.Transparency + 0.1 wait() end end end FF.Touched:connect(Poked)
sonicdiablo
#46206129Tuesday, April 26, 2011 4:46 AM GMT

like thenewfissy did,just to tell you,if you make a condition you have to add FindFirstChild() otherwise if the item that trigger the event dont have Humanoid then the script will crash.
ServerLabs
#46405185Saturday, April 30, 2011 4:12 AM GMT

It's the best option to make sure that your script checks for everything you'll need first. I have run into cases were I forgot to do so, and I broke many scripts.

    of     1