Animation Script not working

So, I used the Roblox animation script from the developer hub: (originally I edited the script but I just changed the animationID)

local Players = game:GetService("Players")
 
local player = Players.LocalPlayer
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:Wait()
end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
 
-- Create new "Animation" instance
local kickAnimation = Instance.new("Animation")
-- Set its "AnimationId" to the corresponding animation asset ID
kickAnimation.AnimationId = "rbxassetid://2515090838"
 
-- Load animation onto the animator
local kickAnimationTrack = animator:LoadAnimation(kickAnimation)
 
-- Play animation track
kickAnimationTrack:Play()
 
-- If a named event was defined for the animation, connect it to "GetMarkerReachedSignal()"
kickAnimationTrack:GetMarkerReachedSignal("KickEnd"):Connect(function(paramString)
	print(paramString)
end)

and it didn’t work. Could someone tell me the correct script please?

why are you using a animator if theres already a humanoid just do

local kickAnimationTrack = humanoid:LoadAnimation(kickAnimation)

Uh doesn’t work. What I want to know the correct script to play an animation. I am using a rig

oh, I dont know then, never used a rig before sorry.

1 Like

Nevermind I found it
have a good night or whatever time of day it is everyone!