local SwingAnim = Instance.new("Animation")
SwingAnim.AnimationId = "rbxassetid://6617680007"
UseEvent.OnServerEvent:Connect(function(player)
local Char = player.Character or player.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")
if Humanoid then
local AnimToPlay = Humanoid:LoadAnimation(SwingAnim.AnimationId)
end
end)
The error comes from this line: local AnimToPlay = Humanoid:LoadAnimation(SwingAnim.AnimationId)
1 Like
Remove .AnimationId, LoadAnimation expects an Animation Instance, also use Animator instaed of Humanoid since the latter is the deprecated method
local AnimToPlay = Humanoid.Animator:LoadAnimation(SwingAnim)
Wdym by animator? is that a new instance?
1 Like
It’s just the now recommended way of Loading animations, it’s just an instance in humanoids used for animation stuff
1 Like
when I remove animationid that error doesnt appear but the animation deosnt paly
1 Like
Because you don’t have code to play it, after that line, include this
AnimToPlay:Play()