Animation not playing help

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local makimaEvent = ReplicatedStorage:WaitForChild("makimaEvent")

local plr = players.LocalPlayer
local hrp = plr.Character:WaitForChild("HumanoidRootPart"):: BasePart
local humanoid = hrp.Parent:WaitForChild("Humanoid"):: Humanoid

local allPlayers = players:GetPlayers()


plr.Chatted:Connect(function(message)
	
	local allPlayers = players:GetPlayers()
	for _,player in allPlayers do
		if (message:lower() == player.DisplayName:lower() 
			or message:lower() == player.Name:lower())
			and player ~= plr then
			
			local target = player
			local targetHRP = target.Character:WaitForChild("HumanoidRootPart"):: BasePart
			local targetHumanoid = target.Character:WaitForChild("Humanoid"):: Humanoid
			
			local rayOrigin = targetHRP.Position
			local direction = Vector3.new(0,-200,0)			
			local params = RaycastParams.new()
			params.FilterType = Enum.RaycastFilterType.Exclude
			params.FilterDescendantsInstances = {target.Character}			
			
			local rayResult = workspace:Raycast(rayOrigin,direction,params)
			
			if rayResult == nil then return end
			
			local targetPos = rayResult.Position
			
			local targetShirt = target.Character:FindFirstChild("Shirt"):: Shirt
			local targetPants = target.Character:FindFirstChild("Pants"):: Pants
			
			local shirtId = targetShirt.ShirtTemplate
			local pantsId = targetPants.PantsTemplate
			
			local myAnimator = humanoid:WaitForChild("Animator"):: Animator
			local squishAnimation = Instance.new("Animation"):: Animation
			squishAnimation.AnimationId = "rbxassetid://88088160344533"
			local squishAnimationTrack = myAnimator:LoadAnimation(squishAnimation)
			squishAnimationTrack:Play()

			local targetAnimator = targetHumanoid:WaitForChild("Animator"):: Animator
			local squashAnimation = Instance.new("Animation"):: Animation
			squashAnimation.AnimationId = "rbxassetid://87272749576622"
			local squashAnimationTrack = targetAnimator:LoadAnimation(squashAnimation)
			squashAnimationTrack:Play()
			
			makimaEvent:FireServer(targetPos,targetHRP,shirtId,pantsId,targetHumanoid)
			

		end
	end
end)

I’m pretty sure its just some stupid mistake I’ve made, but can anyone see why my animation might not be playing, the animation priority is action and I uploaded the animations myself

2 Likes

Please provide console logs, This can help pinpoint the issue.

One thing is, you shouldn’t be loading the animation from a new animation instance, there is a 256 animation track limit.
This will stop new animations from playing.

Seems I am unable to load this animation in Moon Animator, with the built in Roblox Import function. Is it possible you are providing a blank animation track? I Tried with both R6 and R15.

You have a lot of things wrong. First, never EVER use : in front of a variable. The code will think that the letter is part of the variable name and not the variable itself. Second, most of the things you do can be shortened to either less code, which will run faster, or just be shortened.

1 Like

Mhm, he should be using --stringhere instead of : : stringhere