Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tool animation isnt loading?

I first tried just making the animation in a local script but I was told I probably couldn't do that. I tried making it in a server script then playing it from a tool, but the animation still wont load.

-- Server Script
game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		if plr.Backpack:FindFirstChild("Knife") then
			local swingAnim = Instance.new("Animation",plr.Backpack.Knife)
			swingAnim.AnimationId = "rbxassetid://4928252907"
			swingAnim.Name = "knifeSwing"
		elseif char:FindFirstChild("Knife") then
			local swingAnim = Instance.new("Animation",char.Knife)
			swingAnim.AnimationId = "rbxassetid://4928252907"
			swingAnim.Name = "knifeSwing"
		end
	end)
end)

-- Tool Script
script.Parent.Activated:Connect(function()
	
	local swingAnim = script.Parent:WaitForChild("knifeSwing")
	local swingTrack = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(swingAnim)
	swingTrack:Play()
	print("swing")
end)

1 answer

✓ Accepted answer

It seems like your asset id, 4928252907 is actually published as a model instead of an animation. You would have to upload this as an animation in order to load it in correctly.

You can find a screenshot here.

1 comment

0

Thank you, just to confirm, I do have to use a server script to make an animation instance right?

This discussion is preserved as it was. New answers, comments, and votes are closed.