generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: health is not a valid member of Part

Previous Thread :: Next Thread 
Gladii is not online. 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 is not online. 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
Exscriptzit is not online. Exscriptzit
Joined: 11 Oct 2014
Total Posts: 89
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 is not online. LuaLlama
Joined: 25 Jan 2014
Total Posts: 1123
29 Jun 2015 10:51 AM
if part:FindFirstChild("health") then

--code

end
Report Abuse
Exscriptzit is not online. Exscriptzit
Joined: 11 Oct 2014
Total Posts: 89
29 Jun 2015 10:52 AM
Excuse me, I didn't mean print I meant error
Report Abuse
Gladii is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image