There are no errors, this script is in the tool.
local tool = script.Parent
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChild("Humanoid")
humanoid.Health = humanoid.Health + 40
end)
```
There are no errors, this script is in the tool.
local tool = script.Parent
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChild("Humanoid")
humanoid.Health = humanoid.Health + 40
end)
```
Is this a local script or a server script? If it’s a local script, change it to a Server Script? You should also check to make sure the humanoid exists before running the rest of the code.
local tool = script.Parent
tool.Activated:Connect(function()
local humanoid = tool.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.Health = humanoid.Health + 40
end
end)
This is a server script
And it prints Humanoid
Would the desired Health exceed the MaxHealth?
maybe try humanoid:TakeDamage(-40)
I tried this myself, and I noticed that if you don’t have anything in the tool (specifically the handle), the Tool.Activated event will not fire. When I added the “Handle” part, the code worked perfectly fine.
So you just want to include a part inside the Tool and rename it to Handle.
Yes it has a handle. And require handle is on.
No, I set my health to 60 and then tried the tool yet nothing happened.
have you tried humanoid:TakeDamage(-40)?
How did you set your health to 60? Did you do it from the explorer/properties menu while running the game or did you use something else like chat commands? If you used the explorer/properties menu or even the command bar to change your health, that could be why it isn’t working, since the client is changing the health, while you are using a server script to add the health.
I always forget about that. After I switched to server side and took away my health it worked.