I'm trying to make an efficient tool system for my game. I want to load animations through a tool module in the module script, but when I try to do it, I get the error:
LoadAnimation requires an Animation object
I can't think of any other reason this is happening other than it being a module, as this works just fine on local and server scripts. If anyone knows a way I can do this inside the script, that'd be great.
Here's my code:
local replicatedStorage = game.ReplicatedStorage
local toolFolder = replicatedStorage.Tools
local entries = {
["GLOCK20"] = {
tool = toolFolder.GLOCK20,
}
}
function entries.GLOCK20.start(entry,player,tool)
local entry = entry
local tool = tool
local animations = tool.Animations:GetChildren()
local character = player.Character
character.Humanoid.Animator:LoadAnimation(animations.HOLD):Play()
character.Humanoid.Animator:LoadAnimation(animations.HOLDIDLE):Play()
end
function entries.start(entry,player,tool)
if player and player.Parent == game.Players then
local tool = tool
local char = player.Character
entries[tool.Name].start(entry,player,tool)
end
end
return entries

2 comments
Thank you so much. I wrote this script at like 3 in the morning yesterday, but I still have no clue how I didn't notice that. Thanks for the help, and sorry for wasting your time.
Everybody makes stilly mistake like that especially at that time. You are not wasting anybody's time as we are volunteers and we are glad to help.