Introduction
Hello I just got back into trying to script again and have been getting more into Module Scripts, I need help with trying to make a Attack Function for my small dummy boss with animation implemented, how I want it to work is for the function I put the name of the dummy boss, and the name of the attack I want it to do, then theres another function that looks for the name of that attack I named inside of the Animations folder, I keep getting an error and need help with it.
The Module ( Inside of The Script )
local Attacks = {}
function Attacks.PlayAnimation(Char, Animation)
local Character = Char
local HumanoidExists = Character:FindFirstChild("Humanoid") and Character:FindFirstChild("Animations")
if HumanoidExists then
local HumAnim = HumanoidExists:LoadAnimation(Character.Animations:FindFirstChild(Animation))
HumAnim:Play()
end
end
function Attacks.Attack(Char, Attack)
local Character = Char
local HumanoidExists = Character:FindFirstChild("Humanoid")
if HumanoidExists then
Attacks.PlayAnimation(Char, Attack)
end
end
return Attacks
The Script ( Inside of the Dummy )
local AttacksModule = require(script.Attacks)
local Dummy = script.Parent
while true do
AttacksModule.Attack(Dummy, "Stomp")
wait(5)
end
Errors
LoadAnimation is not a valid member of Folder "Workspace.Starter-Dummy.Animations"
Script 'Workspace.Starter-Dummy.Handler.Attacks', Line 7 - function PlayAnimation
Script 'Workspace.Starter-Dummy.Handler.Attacks', Line 16 - function Attack - Studio - Attacks
Any kind of help would greatly be appreciated.