I got a script from a wiki and change it a little but im still not sure if you can play Animations for an NPC if it can then this won't work
local equips = Instance.new("Animation")
equips.AnimationId = "http://www.roblox.com/Asset?ID=163203876"
local animation1 = Instance.new("Animation")
animation1.AnimationId = "http://www.roblox.com/Asset?ID=163203876"
local animation2 = Instance.new("Animation")
animation2.AnimationId = "http://www.roblox.com/Asset?ID=163203876"
AttackCoolDown = math.random(2,3)
function equip(Source)
animTrack2 = script.Parent.AI:LoadAnimation(equips)
animTrack2.KeyframeReached:connect(function(keyframeName)
if keyframeName == "ElectrocuteEnd" then
canPlay = true
end
end)
animTrack2:Play()
end
function anim1(Source)
animTrack1 = script.Parent.AI:LoadAnimation(animation1)
animTrack1.KeyframeReached:connect(function(keyframeName)
if keyframeName == "ElectrocuteEnd" then
canPlay = true
end
end)
animTrack1:Play()
end
function anim2(Source)
animTrack2 = script.Parent.AI:LoadAnimation(animation2)
animTrack2.KeyframeReached:connect(function(keyframeName)
if keyframeName == "ElectrocuteEnd" then
canPlay = true
end
end)
animTrack2:Play()
end
equip()
while true do
Choose = math.random(1,2)
wait(AttackCoolDown)
if Choose == 1 then
anim1()
elseif Choose == 2 then
anim2()
end
end
