Scripting Animation help

  1. I want my player’s character to play a grab animation like the one in the recent popular roblox game called “infectious smile”

  2. When I click my mouse, the animation isn’t running

  3. I don’t know how to script animation very well so I have no idea what is the solution

local userInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local player = Players.LocalPlayer:Wait()
local character = player.Character
if not character or not character.Parent then
	character = player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")

local function grabHuman(input, gameProcessedEvent)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then



Btw, this character is a character in which the player change to like the roblox game piggy where a player’s character gets changed into a pig.

Where’s your animation instance? Where are you loading the animation?

If you don’t have an animation, I’d recommend you to learn on how to animate through some simple quick YouTube searches.

The animation is the print statement, but the print isn’t even printing so that means that if I have an animation, it won’t work also

You need to remove the :Wait() here since that’s not a method of local player. It’s causing an error which is keeping the script from running.

Players.LocalPlayer always exists on local scripts so there’s no need to replace it with anything either.

I did that because at the beginning of the game, this character is parented to the serverStorage. So I thought that it can’t get the local player because its not parented to any players until I manually do it