I'm having a hard time understanding whats happening. I made a medkit and a Damage Brick. The medkit works fine at healing on It's own, but when I take damage from the Brick I heal and It just regresses. I've spent almost 2 hours trying to find out whats wrong, any help?
Kill Brick(server script)
local trapPart = script.Parent
local function onPartTouch(otherPart)
local partParent = otherPart.Parent
local humanoid = partParent:FindFirstChildWhichIsA("Humanoid")
if humanoid then
humanoid:TakeDamage(10)
end
end
trapPart.Touched:Connect(onPartTouch)
medkit(Local script)
local tool = script.Parent
local player = game.Players.LocalPlayer
repeat wait() until player.character
local character = player.character
local humanoid = character.Humanoid
function health()
humanoid.Health = humanoid.Health + 30
tool.Enabled = false
end
tool.Activated:Connect(health)
tool.Equipped:Connect(function()
tool.Enabled = false
end)
Starter Player health script(Local script)
local player = game.Players.LocalPlayer
repeat wait() until player.character
character = player.character
humanoid = character.Humanoid
humanoid.Health = 10
The medkit ONLY stops working when you take damage from the brick.

1 comment
This is most likely because you’ve set the health of the last set of code to 10. Try changing it to 100 and see.