Fliers11
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 1188 |
|
|
| 08 Apr 2012 08:14 PM |
Here's an "if" statement:
if hit.Parent ~= script.Parent.avoid.Value or hit.Parent.Parent ~= script.Parent.avoid.Value then
What it does is it checks if ObjectValue "avoid"'s value is equal to the person it touched, no matter if it touched their hat, gear, or person. Problem is, it does not do that whatsoever...it just follows the script as if that part of the script never existed.
There is an ObjectValue in the brick called "avoid", and it is equal to my character. |
|
|
| Report Abuse |
|
|
Quovis
|
  |
| Joined: 24 Mar 2012 |
| Total Posts: 494 |
|
|
| 08 Apr 2012 08:19 PM |
| Post the whole script please |
|
|
| Report Abuse |
|
|
Fliers11
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 1188 |
|
|
| 08 Apr 2012 08:21 PM |
Here - it's a script put into a brick created when you activate a tool. Don't worry about the tool, everything else works fine.
ting = 0 function onTouch(hit) if hit.Parent ~= script.Parent.avoid.Value or hit.Parent.Parent ~= script.Parent.avoid.Value then if ting == 0 then ting = 1 cnt = Instance.new("Weld") cnt.Parent = script.Parent cnt.Part0 = hit cnt.Part1 = script.Parent cnt.C0 = CFrame.new(Vector3.new(script.Parent.Position - hit.Position), hit.Position) script.Parent.CanCollide = true if hit.Parent:FindFirstChild("Humanoid") ~= nil then if hit.Parent.Name == "Head" then hit.Parent.Humanoid.Health = 0 else hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - math.random(25, 50) end end wait(10) cnt:remove() script.Parent.CanCollide = false end end end script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
Fliers11
|
  |
| Joined: 28 Jul 2009 |
| Total Posts: 1188 |
|
| |
|