I have a script to make my character do a animation when i click with the mouse button but it does the animation only when im walking or jumping, and not by clicking with the mouse.
ps: this is a local script in the StarterPack
local player = script.Parent.Parent
local mouse = player:GetMouse()
local sword = player.PlayerGui.UI.Armor.Sword.ItemClass
local A = Instance.new("Animation")
A.AnimationId = "http://www.roblox.com/Asset?ID=182377268"
local B = Instance.new("Animation")
B.AnimationId = "http://www.roblox.com/Asset?ID=182377825"
mouse.KeyDown:connect(function(key)
if sword.Value == "Sword" then
local animTrack = player.Character.Humanoid:LoadAnimation(A)
animTrack:Play()
elseif sword.Value == "Axe" then
local animTrack = player.Character.Humanoid:LoadAnimation(B)
animTrack:Play()
end
end)

1 comment
In my opinion, you did the link wrong, try changing it to 'http://www.roblox.com/asset/?id=182377825'.