I am learning how to use a module script with a combat system and it is working to the point of where it has to play an the hit animation at which point it gives an error/ Play is not a valid member of Animation, the module script also contains the function for the server side of the combat system but that works perfectly
I tried moving the location of the animation in multiple different places like the replicated storage, server storage and parenting it to the local script.
wait for child and find first child doesnt work.
inside the local script
local player = game:GetService("Players").LocalPlayer
local uis = game:GetService("UserInputService")
local simplePunch = require(game.ReplicatedStorage.combatLibrary)
local keybind = Enum.KeyCode.E
local animation = script:WaitForChild("simplePunch1")
uis.InputBegan:Connect(function(input, IS)
if IS == true then return end
if input.keyCode == keybind then
simplePunch.combatSkillClient(3, animation) -- calling the combatSkill from library
end
end)
inside the module script
function combat.combatSkillClient(cooldown, animation)
local player = game.Players.LocalPlayer
local debounce = false
if debounce == true then return end
debounce = true
game.ReplicatedStorage.combatSkills.SimpleHit:FireServer() -- fires remove event to the server
local anim = animation:Clone()
anim:Play()
game.Debris:AddItem(anim, 2)
print("E was pressed")
wait(cooldown)
debounce = false
end
and this is the error