Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 29 Jun 2015 10:26 AM |
It doesn't make sense. I have an If statement checking if 'health' exist and the output still says it doesn't?
if part.health then if part.health.Value >= 1 then tool.Activated:connect(function() local anim = Instance.new("StringValue") anim.Name = "toolanim" anim.Value = "Slash" anim.Parent = tool end) end else end |
|
|
| Report Abuse |
|
|
isc88
|
  |
| Joined: 30 May 2013 |
| Total Posts: 27545 |
|
|
| 29 Jun 2015 10:50 AM |
Why are you checking for a part's health?!
what siggy |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 10:51 AM |
| If you're not wanting it to print then you'll do if part:FindFirstchild('Health') then etc. |
|
|
| Report Abuse |
|
|
LuaLlama
|
  |
| Joined: 25 Jan 2014 |
| Total Posts: 1123 |
|
|
| 29 Jun 2015 10:51 AM |
if part:FindFirstChild("health") then
--code
end |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2015 10:52 AM |
| Excuse me, I didn't mean print I meant error |
|
|
| Report Abuse |
|
|
Gladii
|
  |
| Joined: 10 Mar 2012 |
| Total Posts: 1713 |
|
|
| 29 Jun 2015 10:59 AM |
I've tried that, but it is not working with the rest of my script... I have a small idea why but i have no idea how to fix. The point of the script is to only swing when the tool is touching a part with health but when you do that for the first time, it swings on all of the rest that don't have health.
local tool = script.Parent local handle = tool.Handle local debounce = false
tool.Equipped:connect(function() end)
handle.Touched:connect(function(part) if part.ClassName == "Part" and debounce == false then if part:FindFirstChild("health") then tool.Activated:connect(function() if part.health.Value >= 1 then debounce = true local anim = Instance.new("StringValue") anim.Name = "toolanim" anim.Value = "Slash" anim.Parent = tool wait(1) debounce = false end end) else end end end) |
|
|
| Report Abuse |
|
|