#LoadAnimation can't find Animation object
1 messages · Page 1 of 1 (latest)
** You are now Level 1! **
the error btw
give m1animationcycle:getchildren() a different variable name from Animation, maybe something like Animations or AnimationList, make sure M1Combo.Value is a number from 1 to 4, and you could probably write the animation variable as
Animation = AnimationListVariable:FindFirstChild(tostring(M1Combo.Value))```
what is M1Combo.Value?
try printing it's value
Program Output
1
.pyrofire | lua | lua-5.4.7 | wandbox.org
that's just jank bruh
anyway maybe the value is 0 or something, either way the error is saying animation is probably nil
1
did that and got this error, (1 from line 29 is M1Combo.Value)
Alright I worked on it myself and it finally sort of works
It just
it only does it once though
Alright I fixed it myself
thanks so much everyone for the help
local Players = game:GetService("Players")
local Events = ReplicatedStorage.Events
local AttackHitboxes = require(script.Parent.AttackHitboxes)
local SaberM1Debounces = {}
Events.SaberM1.OnServerEvent:Connect(function(Player)
local Character = Player.Character
if not Character then return end
local Humanoid = Character:FindFirstChild("Humanoid")
if not Humanoid or Humanoid.Health <= 0 then return end
if SaberM1Debounces[Player] then return end
SaberM1Debounces[Player] = true
local M1Combo = Player.Values.M1Combo
local Animations = script.M1AnimationCycle:GetChildren()
local comboNumber = tonumber(M1Combo.Value) or 1
if comboNumber > #Animations then
M1Combo.Value = 1
else
M1Combo.Value = comboNumber + 1
end
local Animation = Animations[comboNumber]
if Animation then
local LoadedM1Animation = Humanoid.Animator:LoadAnimation(Animation)
LoadedM1Animation:Play()
task.wait(LoadedM1Animation.Length)
else
warn("Animation not found for combo:", comboNumber)
end
SaberM1Debounces[Player] = nil
end)```