Hello I’m currently trying to find a way to store animations, using animationId’s and referencing the animations through an table using (ModuleScript) which will load the animations to the character at a specific event through local script called Animate in StarterCharacterScripts.
I keep receiving (Walk is not a valid member of ModuleScript “ReplicatedStorage.AnimationsTable”)
Puzzled, and not sure how to fix it. Bellow is the script. I used the Assistant AI in to help me learn how to script along with documentation as well. by the way, no errors, warnings, reports, or hints were visible in the Script Analysis.
(Module Script)
local AnimationTablemodule = {
[“Walk”] = “rbxassetid://15791500540”,
[“Jump”] = “rbxassetid://15779173308”
}
return AnimationTablemodule
(Local Script)
–local humanoid
local humanoid = script.Parent:WaitForChild(“Humanoid”)
–where replication storage is
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
–refernce to animation table
local AnimationTable = ReplicatedStorage:WaitForChild(“AnimationsTable”)
–humanoid instance
local humanoid = script.Parent:WaitForChild(“Humanoid”)
local function playAnimation(animationId)
local animation = Instance.new(“Animation”)
animation.AnimationId = animationId
local animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
end
local function stopAnimation()
for _, animationTrack in pairs(humanoid:GetPlayingAnimationTracks()) do
animationTrack:Stop()
end
end
humanoid.Running:Connect(function(speed)
if speed > 0 then
playAnimation(AnimationTable["Walk"])
else
stopAnimation()
end
end)
humanoid.Died:Connect(stopAnimation)