Animation won't play

I made an animation for picking up a snowball, but it doesn’t play. I exported and saved it on Roblox. When I checked it on the Roblox website it did play (because I have a Chrome extension that plays Roblox animations). But when I loaded into Roblox and played the animation track it just doesn’t play. I own and animation and I tried reloading assets and restarting studio, but it still doesn’t work.

Here’s my code:

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local UserInputService = game:GetService("UserInputService")
local Snowball = game.ReplicatedStorage:WaitForChild("Snowball")
local Character = Player.Character or Player.CharacterAdded:Wait()
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
local Humanoid = Character:WaitForChild("Humanoid")

local SnowballPickupAnimation = Instance.new("Animation")
SnowballPickupAnimation.AnimationId = "rbxassetid://2475244717"
local SnowballPickupAnimationTrack = Humanoid:LoadAnimation(SnowballPickupAnimation)

local clone = Snowball:Clone()
clone.CanCollide = false
clone.Anchored = false
clone.CFrame = Character:WaitForChild("Right Arm"):WaitForChild("RightGripAttachment").CFrame
clone.Parent = Character["Right Arm"]
clone.Name = "Handle"

for i,v in pairs(clone:GetChildren()) do
	v:Destroy()
end

local weld = Instance.new("Weld")
weld.Part0 = clone
weld.Part1 = Character["Right Arm"]
weld.C0 = CFrame.new(0, 1, 0)
weld.Parent = clone

local hasBall = false

UserInputService.InputBegan:Connect(function(input, processed)
	if processed then return end
	if input.UserInputType == Enum.UserInputType.MouseButton1 and not hasBall and ((HumanoidRootPart.Position - Vector3.new(0, 3, 0)) - Mouse.Hit.Position).Magnitude <= 3.5 and (Mouse.Target.Name:match("Snow") or Mouse.Target.Name:match("snow")) then
		SnowballPickupAnimationTrack:Play()
		print("pla")
	end
end)

Anything helps, thank you!

1 Like

Hi, when playing your animation, you should try and define fadetime & weight.
https://create.roblox.com/docs/reference/engine/classes/AnimationTrack#Play
Personally I would suggest the following:

ActivatedAnimation:Play(nil, 10)

Also make sure that your Animation priority is set to minimum “Action1”, this can be done in the editor, where you animate the animation.

3 Likes

I changed the code and added that but for some reason, it still doesn’t work. I have a different script with a charge and throw snowball animations and those work just fine even without the nil, 10, but this animation still won’t work.

Nevermind, I just uploaded the animation to a different animation that I own and it fixed the problem.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.