[SOLVED] Animation Playing On Damage Taking

Show me a clip, I must see for myself.

Updated my code to reflect this @GamerBoi9873RB, try my code again.

Scripting Support is not a location to ask for code, it is a place to gain assistance in writing scripts. If you are not going to put in the effort to learn and instead try asking people to write out your items, please do not use this category. That is also to say that I have flagged a good number of your posts. People are trying to assist you, so do not respond rudely or ignore the input you are being given. That is the worst thing you can do here.

You also need to stop spamming. Contain your posts in one section. Repeatedly posting is a thing called bump posting, which is not allowed on this thread. You were given many information threads upon being promoted to New Member; you are expected to read and understand them.

8 Likes

Look, this is my first time actually, you know, having a topic and all that. Don’t go all harsh on me when it’s my first time.

To avoid more posts, if it is possible, could you DM me a place file so I could edit it and fix it.

It doesn’t matter if it’s your first time. Rules exist and the guidelines were sent to you upon your promotion to New Member. You should always read the rules first and gain an understanding of how things work before proceeding - those threads are pinned for a reason.

Being new is not an excuse for low quality posts or rudeness.

3 Likes

2 Likes

I already tried deleting the topic. I even flagged it so it could get taken down, but it won’t. I want it out of here.

Flagging the post may result in having moderation actions taken on your account. The easiest way to have the thread be locked is to simply ask someone that has that power kindly to do so.

Well, who here has the power to do such a thing?

@Community_Sage

Flagging your own thread to ask for it to be locked is fine, no action is taken on your account. I’ve flagged several of my own posts before.

2 Likes

Right, I guess I’ll just talk to Ayee for now, he said he would help me out, so let’s get this thread locked.

I was actually not aware that one could do that. Thank you for that information.

2 Likes

Here’s the code that works, for anyone who is interested.

local Humanoid = script.Parent.Humanoid

local youranimation = Instance.new('Animation')
youranimation.AnimationId = 'rbxassetid://2152103254' -- please note that other users cannot load your animations, so there is no need to hide it.

repeat wait() until Humanoid:IsDescendantOf(workspace)
local AnimationTrack = Humanoid:LoadAnimation(youranimation)
AnimationTrack.Priority = Enum.AnimationPriority.Action

local LastKnownHealth
game:GetService('RunService').RenderStepped:Connect(function()
	if LastKnownHealth then
		if LastKnownHealth > Humanoid.Health then
			print('Playing')
			AnimationTrack:Play()
		end
	end
	
	LastKnownHealth = Humanoid.Health
end)
15 Likes