Scripts wont play animation at all

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? A script that plays a animation when I click.

  2. What is the issue? It wont play the animation, or my game wont. No matter of what type of script, or what type of tutorial I take it from. It wont play the animation. It even prints out to “Playing Animation”.

  3. What solutions have you tried so far? Everything.

local Tool = script.Parent -- Defines tool
print("Before tool activated") -- Testing Where Script Ends

Tool.Activated:Connect(function() -- Function starts when tool clicks
	local Char = Tool.Parent -- Gets player from tool
	local Humanoid = Char:FindFirstChildWhichIsA("Humanoid") -- Get humaniod from player
	print("After defining humanoid") -- Testing Where Script Ends

	if Humanoid then -- checks if the thing has a humaniod
		Humanoid.Health = Humanoid.Health - 2 -- Testing Where Script Ends
		local animation = script:FindFirstChild("AnimationR6")
		if animation then
			print("Playing Animation") -- Testing Where Script Ends
			local animationTrack = Humanoid:LoadAnimation(animation) -- Defeines animation numbers
			animationTrack:Play() -- Should Play animation
		else
			print("AnimationR6 not found") -- Errors
		end
	else
		print("Humanoid not found") -- Errors
	end
end)

Screenshot 2023-08-21 001134

Screenshot 2023-08-21 001139

3 Likes

You need to own animation to use it. Also your group need to have it if game is from group, but it not always work in studio but it should work in game.

1 Like

There is a chance you didn’t set your animation priority. Did you?

2 Likes

This didn’t have anything about what you said I swear. Can you celebrate?

Hmmm how do i explain this.
From what i understand it is like animation overweight each other.When the one with higher priority play the lowers will still play but we can’t see it as the highest one overweight them all.
If two animations have the same priority both will play at the same time make the character moving at half of both animations.

For better explaining: https://create.roblox.com/docs/reference/engine/enums/AnimationPriority

You asked about that meaning you didn’t set the animation priority. In Animation editor, click the 3 dots you can see “Set Animation Priority” just set it higher than Core, which is roblox default animations using.

1 Like

Yeah I figured that out thank you.

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