I'm writing a sword script. When someone clicks, A random selection (of 3) is ticked. This plays an animation via the Animation Script. I get this error:
19:21:14.931 - Argument 1 missing or nil 19:21:14.931 - Script 'Players.Player.Backpack.Wooden Sword.SwordScript', Line 155 19:21:14.932 - Stack End
and I have no idea why. I have never come across this error before. This is the part of the script that errors.
function onActivated()
if not Tool.Enabled then return end
Tool.Enabled = false
local character = Tool.Parent;
local humanoid = character.Humanoid
if humanoid == nil then return end
attack()
local num = 5 --Change 5 to the number of maps you have
local anims = {"PlayThrust", "PlaySlash", "PlayOverhead"} --Put their names here, add more if you have to
local m = math.random(1,num)
script.Parent:findFirstChild(anims[m]).Value = true --error here
wait(1)
Tool.Enabled = true
end
Any help is appreciated. Thanks!
