|
| 17 Dec 2012 09:30 PM |
Can I please have some help here:
function Touch(hit) if hit.Parent.Name == "Player1" then print("inprosses") if hit.Parent:IsA("Hat") then hit.Parent.Humanoid.Health = 0 print("dead") elseif hit.Parent.Name ~= "Player1" then print("working") hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(0, 50, 0)) end end end script.Parent.Touched:connect(Touch)
it only does the first if not the second please help. |
|
|
| Report Abuse |
|
|
CokeCody
|
  |
| Joined: 31 Mar 2010 |
| Total Posts: 394 |
|
|
| 17 Dec 2012 09:38 PM |
| hit.Parent.Torso.CFrame = CFrame.new(0, 50, 0) |
|
|
| Report Abuse |
|
|
megaguy44
|
  |
| Joined: 28 Sep 2008 |
| Total Posts: 1066 |
|
|
| 17 Dec 2012 09:39 PM |
What exactly are you trying to do in this script?
print('Hello World!') |
|
|
| Report Abuse |
|
|
CokeCody
|
  |
| Joined: 31 Mar 2010 |
| Total Posts: 394 |
|
|
| 17 Dec 2012 09:41 PM |
Hats don't have a humanoid so it'd be if hit.Parent:IsA("Model") and hit.Parent:findFirstChild("Humanoid", true) then |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2012 06:15 PM |
| Look i=the Handle of the hat touches the brick. This dose not have a humanoid therefore causing an error. I am trying to run a function to test if it is a "Hat". |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2012 06:22 PM |
| Thanks it worked. Silly me. Running a test if it was a MODEL instead of a hat would not need the 3D function |
|
|
| Report Abuse |
|
|
|
| 21 Dec 2012 06:25 PM |
function Touch(hit) if hit.Parent.Name == "Player1" then print("inprosses") if hit.Parent:FindFirstChild("Humanoid",true) then for _,v in pairs(script.Parent:GetChildren()) if v:isA("Hat") the hit.Parent.Humanoid.Health = 0 print("dead") end end elseif hit.Parent.Name ~= "Player1" then print("working") hit.Parent.Torso.CFrame = CFrame.new(Vector3.new(0, 50, 0) end end end script.Parent.Touched:connect(Touch)
This would kill you if you have a hat of that's what you intended...if not what do you want it to do...
|
|
|
| Report Abuse |
|
|
| |
|