Script For A Healing Tool

I’m basically making a tool that would heal a player to 90 health. Obviously, it wouldn’t bring someone’s health down if it was above 90 health. Everything in the script works, but the part that is supposed to heal the player. Here’s the script:

local Animation = Tool.Animation

Tool.Activated:Connect(function()
	local Character = Tool.Parent
	local Humanoid = Character.Humanoid
	
	local AnimationTrack = Humanoid:LoadAnimation(Animation)
	AnimationTrack:Play()
	if Humanoid.Health < 90 then
		Humanoid.Health = 90
	end
	wait(1)
	Tool:Destroy()
end)

(The output doesn’t say anything.)

1 Like

Humanoid:LoadAnimation() is deprecated, replace Humanoid with Animator, a child of the player’s character’s humanoid instead.

2 Likes

Should I change the whole variable to Animator or just the line?

1 Like

Make sure that your tool has the RequiresHandle property off. If your tool is in the workspace you can find the property and make sure it is unticked.

1 Like

Make it so that If the humanoid does have the Animator, use it, otherwise use Humanoid:LoadAnimation().

1 Like

Nevermind, it should’ve been in a LocalScript, not a Script. ;-;

1 Like

If it is in a localscript then the player’s health will only be changed locally. They won’t actually be healing on anyone else’s screen or to the server.

3 Likes

Yeah, I just figured that out. ;-;. Is there anything else I could do? None of it is working.

@xBaggyBoi You can play the animation locally and then fire a RemoteEvent and change the health from the server!

1 Like

Create a remote event inside the tool, only play the animation locally, and then use a normal script which fires whenever that remote event is fired, then just do whatever you need to heal.

1 Like