Handle animation not working on tool [Not solved]

I modeled a diamond mesh (shown below) and I want to make it spin using an animation when it is being held in a tool.
image

This is what I am trying to achieve:
Classic Baseplate - Roblox Studio (gyazo.com)
However, when I play the game, the animation does not play.
I just used a free script, I’m not sure if there’s something wrong with it but there are no errors in the Output window.

Here is the script:

-- Credits > axent22
-- Insert inside the tool
local tool = script.Parent
local anim = Instance.new("Animation")
anim.Name = "IdleAnim"
anim.AnimationId = "rbxassetid://15848012120" -- Idle Animaton ID
local track
-- When Tool Equipped
tool.Equipped:Connect(function()
	track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
	track.Priority = Enum.AnimationPriority.Action
	track.Looped = true
	track:Play()
end)

-- When Tool UnEqiopped
tool.Unequipped:Connect(function()
	if track then
		track:Stop()
	end
end)

I was thinking that if it works properly in the animation window then it should work in the game. But I don’t know why it doesn’t.
If someone could help, it would be greatly appreciated!

2 Likes

If it’s a local script on the client I’m pretty sure it won’t show on the server.
The reason it runs in Studio is that all the gameplay is handled by your computer, not the server.
Could you just CFrame the diamond’s Orientation to spin while it’s equipped?

How would I CFrame the handle? I tried just rotating it with this but it doesn’t work.

while true do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0.0,0.0,0.05) * CFrame.new(0, 0, 0)
	wait(0.001)
end

I used the Search tool up top with the phrase"rotating a tool while holding" and got this, which you can probably use: How to spin a tool while holding using a script?

And use task.wait() instead of wait (it’s better, wait is deprecated)
Also you cant wait(.001). I think the minimum is something like .03 seconds (frame rate of the game) so just use task.wait().

This post shows the solution as using a Motor6D animation, which I already have shown to be working properly in the animation editor. Your other suggestions didn’t make the rotating script work either.

But did you check the client/server issue I mentioned first?

I tried the original script as a server script and got the same results.

Bump (filling in character limit aadsadadasd)

Bump (character limit aaaaaaaaaaa)

I tried searching ‘spinning pets’ since it sounds like something similar to what you’re trying to do and came up with this post:
CFrame Experts I need You - #2 by MysteriousVagabond

I couldn’t CFrame the handle earlier, so why would this work? Also, this is involving a part locking onto the camera’s point of view, which isn’t what I am trying to achieve.

Sorry, I just read through it quickly.

1 Like