player = game.Players.LocalPlayer local Block = player.Character.Humanoid:LoadAnimation(4819470970) local Weaponblock = player.Character.Humanoid:LoadAnimation(4819498690) local Weaponblockshield = player.Character.Humanoid:LoadAnimation(4819501037) local Stance = player.Character.Humanoid:LoadAnimation(4812358432) local m = {} function m.PlayAnimation(anim) local success,err = pcall(function() if anim == "Block" and Block ~= nil then Block:Play() end if anim == "Weaponblock" and Weaponblock ~= nil then Weaponblock:Play() end if anim == "Weaponblockshield" and Weaponblockshield ~= nil then Weaponblockshield:Play() end if anim == "Stance" and Stance ~= nil then Stance:Play() end end) end function m.StopAnimation(anim) local success,err = pcall(function() if anim == "Block" and Block ~= nil then Block:Stop() end if anim == "Weaponblock" and Weaponblock ~= nil then Weaponblock:Stop() end if anim == "Weaponblockshield" and Weaponblockshield ~= nil then Weaponblockshield:Stop() end if anim == "Stance" and Stance ~= nil then Stance:Stop() end end) end function m.SetAnimation(anim, id) local success,err = pcall(function() if anim == "Block" then Block = id end if anim == "Weaponblock" then Weaponblock = id end if anim == "Weaponblockshield" then Weaponblockshield = id end if anim == "Stance" then Stance = id end end) end function m.StopAll() local success,err = pcall(function() Block:Stop() Weaponblock:Stop() Weaponblockshield:Stop() Stance:Stop() end) end return m
You can't put variables outside the module script table. Those variables will not work. I don't know much about ModuleScripts (yet), so that's that. Just put all the variables inside the m table. Plus, local variables that are not in a specific script scope don't need to be changed. Local Variables load faster anyway, so its better.