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

Why cant I play animation?

I am trying to play animation but its not working, the script is working properly and there is no errors but its still not playing the animation.

local player = game.Players.LocalPlayer
local debounce = true

script.Parent.Activated:Connect(function()
	
	if debounce == true then
	
	local plr = script.Parent.Parent
	local animation = plr.Humanoid:LoadAnimation(script.Parent.Animation)
		animation:Play()
		
	print("Tool Activated")
		
		debounce = false
		
		wait(1)
		
		debounce = true
			
	end
end)

1 answer

The fact that you haven't gotten an error or any results makes me think your script isn't running at all, or there's a fundamental misunderstanding of what an error is. Have you done all of the following?

  • This animation you're using is your animation, is loaded, and takes priority over the default animations

  • This code is in a LocalScript

  • This LocalScript is parented to a Tool, as expected based on your code

  • This tool can be activated (Tool.ManualActivationOnly should be false based on your code)

  • This tool has a part named Handle (which it should if RequiresHandle is true on the Tool)

  • The LocalScript is enabled

If all of the following are true and your code still isn't working properly, then I'm not sure my friend. Hope I was of assistance.

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