Tool not adding health to player when used

What do you mean by that?!
It will only add 25 health nothing more. Please recheck your code.

Maybe you could just not make a “local humanoid” variable

local tool = script.Parent
local eatSound = tool.Handle.eat
local equipSound = tool.Handle.equip
local cooldown = false


tool.Equipped:Connect(function()
	equipSound:Play()
end)

tool.Activated:Connect(function()
	if cooldown == false then
		cooldown = true
			eatSound:Play()
			tool.Parent.Humanoid.Health = tool.Parent.Humanoid.Health + 25
			tool.GripForward = Vector3.new(-.981, .196, 0)
			tool.GripPos = Vector3.new(-.5, -0.6, -1.5)
			tool.GripRight = Vector3.new(0, -0, -1)
			tool.GripUp = Vector3.new(0.196, .981, 0)
			wait(0.9)
			tool.GripForward = Vector3.new(-1, 0, 0)
			tool.GripPos = Vector3.new(-.5, -.1, 0)
			tool.GripRight = Vector3.new(0, 0, 1)
			tool.GripUp = Vector3.new(0,1,0)
			wait(3)
			cooldown = false
	end
end)

I’m a little confused. How are you decreasing your health? Are you using a Local Script for that? Or have you been trying to add health when you were already at max health (100)?

His health was not already at max health, as he said above it was 50

I run a command in the console. To set the health to 50. To test the script

Are you using the command bar from the View tab? Because that command bar only runs on the client. You should be using the In-game F9 command bar as that runs on the server.

Try to go to server view and change it in that then go back and try. By the way you cant go over 100 health if the humanoids maxHealth is at 100 already.

No. The max health is 100. But for some reason. When I try humanoid:TakeDamage(-25) It goes over it

I think humanoid:TakeDamage(-25) doesn’t use max health to limit it, you could check if the health is not 100 then you heal the player. Or check if the health is over 75 then you just change the health to 100

That was the problem. I was using the command on the local side not the server side to test it.

1 Like

Anyways. Merry Christmas. And have a great day. Thanks for all the people that helped me on this topic.

2 Likes

Thank you, Merry Christmas and have a great day too

1 Like

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