Health Pickup

Health Pickup

local healthPart = script.Parent

local canHeal = true

local amount = 25


local function health(otherPart)

local humanoid = otherPart.Parent:FindFirstChild('Humanoid')

if humanoid and canHeal then

canHeal = false

local currentHealth = humanoid.Health

humanoid.Health = currentHealth + amount

healthPart.Transparency = 1

healthPart.CanCollide = false

wait(3)

healthPart.Transparency = 0

healthPart.CanCollide = true

canHeal = true

end

end


healthPart.Touched:Connect(health)

Damage Part

local damagePart = script.Parent


local function damage(otherPart)

local humanoid = otherPart.Parent:FindFirstChild('Humanoid')

if humanoid then

humanoid.Health = 25

end

end


damagePart.Touched:Connect(damage)