Every time I click two times while having the the tool equipped it doesn't return the animation object,why?
Why is this function not returning the object?
Player = game.Players.LocalPlayer
Character = Player.Character
Tool = script.Parent
---------------------------------------------------------------------
function CreateAnimation(id,Humanoid)
local AnimationName = "Animation_"..id
local FoundAnimation = Humanoid:FindFirstChild(AnimationName)
if not FoundAnimation then
local Animation = Instance.new("Animation",Humanoid)
Animation.Name = AnimationName
Animation.AnimationId = "http://www.roblox.com/Asset?ID="..id
return Animation
else
return Animation
end
end
---------------------------------------------------------------------
Tool.Equipped:connect(function(Mouse)
print("Equipped")
Mouse.Button1Down:connect(function()
Humanoid = Character.Humanoid
local Animation = CreateAnimation("169093883",Humanoid)
local AnimationTrack = Humanoid:LoadAnimation(Animation)
print(Animation)
end)
end)
