You can write your topic however you want, but you need to answer these questions:
I want to create a module script that has weapon animations held within tables. I then want to reference those tables with animations in a local script.
I keep on getting index nil with ‘Axe’.
Ive tried changing quite a few things but i simply dont understand why it isnt working. I’m not too well versed in module scripts so maybe the answer to the issue is simple.
Module Script
local combatAnims = {}
anims = {
Axe = {
["Idle"] = -- id here,
},
}
return combatAnims
Local Script
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local repstorage = game.ReplicatedStorage
local combatAnims = require(repstorage:FindFirstChild("CombatAnimMod"))
print(combatAnims.anims.Axe["Idle"])
local combatAnims = {}
combatAnims.anims = {
["Axe"] = {
["Idle"] = "123 I'm an ID" -- id here,
}
}
return combatAnims
LocalScript:
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local repstorage = game.ReplicatedStorage
local combatAnims = require(repstorage:WaitForChild("CombatAnimMod"))
print(combatAnims.anims.Axe["Idle"])