So here is the problem, you have the an axe tool, and what it is sapose to do is when you click it and it hits a Tree in this case "Medium Tree" it will go into the log and then go to the value named Resistance and decrease the value by a random amount. But that does not work,
2 ERRORS IN THE OUTPUT **---)**Players.Player.Backpack.WoodenAxe.SwordScript:31: attempt to index local 'humanoid' (a nil value)
**---)**10:49:52.860 - parent is not a valid member of Script
Axe Script
r = game:service("RunService")
ching = false
sword = script.Parent.Handle
Tool = script.Parent
lowdamage = Tool.WeaponSettings.MinDamage.Value
maxdamage = Tool.WeaponSettings.MaxDamage.Value
reload = Tool.WeaponSettings.ReloadTime.Value
local SlashSound = Instance.new("Sound")
SlashSound.SoundId = "rbxasset://sounds\\swordslash.wav"
SlashSound.Parent = sword
SlashSound.Volume = .7
local LungeSound = Instance.new("Sound")
LungeSound.SoundId = "rbxasset://sounds\\swordlunge.wav"
LungeSound.Parent = sword
LungeSound.Volume = .6
local UnsheathSound = Instance.new("Sound")
UnsheathSound.SoundId = "rbxasset://sounds\\unsheath.wav"
UnsheathSound.Parent = sword
UnsheathSound.Volume = 1
function blow(hit)
if ching == true then return end
local humanoid = hit.Parent.Log:findFirstChild("Resistance")
local vCharacter = Tool.Parent
local vPlayer = game.Players:playerFromCharacter(vCharacter)
local hum = vCharacter:findFirstChild("Humanoid")
if humanoid.Value <= 1 then
print("AXE HIT")-- I do not see things printed in the output
local damage = math.random(lowdamage,maxdamage)
humanoid.Value = humanoid.Value - damage
print("Took"..damage"Damage!!")-- I do not see things printed in the output
end
end
function tagHumanoid(humanoid, player)
local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = player
creator_tag.Name = "creator"
creator_tag.Parent = humanoid
end
function untagHumanoid(humanoid)
if humanoid ~= nil then
local tag = humanoid:findFirstChild("creator")
if tag ~= nil then
tag.Parent = nil
end
end
end
function attack()
damage = slash_damage
SlashSound:play()
local anim = Instance.new("StringValue")
anim.Name = "toolanim"
anim.Value = "Slash"
anim.Parent = Tool
end
function swordUp()
Tool.GripForward = Vector3.new(-1,0,0)
Tool.GripRight = Vector3.new(0,1,0)
Tool.GripUp = Vector3.new(0,0,1)
end
function swordOut()
Tool.GripForward = Vector3.new(0,0,1)
Tool.GripRight = Vector3.new(0,-1,0)
Tool.GripUp = Vector3.new(-1,0,0)
end
Tool.Enabled = true
local last_attack = 0
function onActivated()
if not Tool.Enabled then
return
end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then
print("Humanoid not found")
return
end
t = r.Stepped:wait()
if (t - last_attack < .2) then
else
attack()
end
last_attack = t
wait(reload)
Tool.Enabled = true
end
function onEquipped()
UnsheathSound:play()
end
script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
connection = sword.Touched:connect(blow)
There is a script in the value that makes it drop whatever i want it to drop in front of it after resistance <1 here it is
function Drop()
local drops = {"MediumLog", "SmallLog", "MediumLog"}
local G = math.random(1, 5)
local Obj = game.Lighting:findFirstChild(drops[G]):Clone()
Obj.Parent = game.Workspace
Obj.Handle.CFrame = script.Parent.Head.CFrame + Vector3.new(5,2,0)
script:remove()
end
while true do
wait(.1)
if (script.Parent.Value <1) then
Drop()
wait(.1)
script.Parent.Parent.Parent:Destroy()
end
end
while true do
wait(.1)
if (script.Parent.Value <45) then
print("TREE TOOK DAMAGE")-- I do not see things printed in the output
elseif (script.Parent.Value <40) then
print("TREE TOOK MORE DAMAGE")-- I do not see things printed in the output
end
end
while true do
wait(1)
print(script.Parent.Value) -- I do not see things printed in the output
end
Heirarchies --) http://prntscr.com/a5qvwy **--)**http://prnt.sc/a5qvsw
All Usefull Help Appreciated ^.^

2 comments
For the first error, in that i statement, you're auto-assuming that humanoid exists. You have to check if it first exists..
In your second script you are encountering problems because you have 3 "while true do" loops, but none of them ever break. Roblox won't ever get past executing the first one. Either make 3 different scripts, use coroutines, or combine the while loops.