When I join the game Im able to equip my sword that does a little animation. But when I die and re - equip the sword, I cant do the animation any more when I equip it... the error is here below...
"17:50:08.389 - LoadAnimation requires the Humanoid object (Tizzel40.Humanoid) to be a descendant of the game object"
I dont understand why. When equipped, you should do a simple animation, every time, no matter what if you die.
--- This script Only alwos you to do the animation only if you dont die. However, If you do die, the whole script gives an error...
here is the script (The Problem is on lines 13 - 18)
local Remote = script.Parent:WaitForChild("Remotes").damage
local play = game.Players.LocalPlayer
local character = play.Character or play.CharacterAdded:wait()
local use = false
local hum = character:WaitForChild("Humanoid")
local attackvalue = 1
local idleanim = hum:LoadAnimation(script.Parent:WaitForChild("Animations").Idle)
local eqipinganim = hum:LoadAnimation(script.Parent:WaitForChild("Animations").equipped)
script.Parent.Equipped:Connect(function()
eqipinganim:Play()
end)
script.Parent.Activated:Connect(function()
local Damage = math.random(100,110)
local char = play.Character
local attacken = char:WaitForChild("CanAttack")
------------if play.Character.ShieldPoints.Value == 0 then
print("no swing")
if attackvalue == 1 then
if use == false and attacken.Value == true then
use = true
attackvalue = 2
print("swing")
local hitanim = script.Parent:WaitForChild("Animations").Attack1
local hitplay = play.Character.Humanoid:LoadAnimation(hitanim)
hitplay:Play()
Remote:FireServer(Damage)
wait(.4)------------cooldown number
use = false
end
elseif attackvalue == 2 then
if use == false and attacken.Value == true then
use = true
attackvalue = 3
print("swing2")
local hitanim = script.Parent:WaitForChild("Animations").Attack2
local hitplay = play.Character.Humanoid:LoadAnimation(hitanim)
hitplay:Play()
Remote:FireServer(Damage)
wait(.5)------------cooldown number
use = false
end
elseif attackvalue == 3 then
if use == false and attacken.Value == true then
use = true
attackvalue = 1
print("swing2")
local hitanim = script.Parent:WaitForChild("Animations").Attack3
local hitplay = play.Character.Humanoid:LoadAnimation(hitanim)
hitplay:Play()
Remote:FireServer(Damage)
wait(.7)------------cooldown number
use = false
end
end
----end
end)
--scripted by Tizzel40

1 comment
In the future, paste your code in as regular text first and then select it and hit the code block button. It has less of a chance to lose indentation and almost no chance for the spacing to break.