Model = script.Parent
Trigger = Model:WaitForChild("Medikit")
Sound = Trigger:WaitForChild("Sound")
Config = Model:WaitForChild("Configuration")
HealthAdd = Config:WaitForChild("Health")
WaitTime = Config:WaitForChild("RegenTime")
Ready = true
function onTouched(MKit)
local Humanoid = MKit.Parent:FindFirstChild("Humanoid")
if Humanoid ~= nil then
if Humanoid.Health < 100 then
if Ready then
Ready = false
Sound:Play()
Humanoid.Health = Humanoid.Health + HealthAdd.Value
Trigger.Transparency = 1
wait(WaitTime.Value)
Trigger.Transparency = 0
Ready = true
end
end
end
end
Trigger.Touched:connect(onTouched)
while true do
Trigger.CFrame = Trigger.CFrame * CFrame.fromEulerAnglesXYZ(0, 0.01, 0)
wait()
end
Very simple: put the healing sequence in a if loop, and use Humanoid.Health < 100. This is what @Harrystylesicoo17287 did. But I think it’s better to understand than just copy-pasting a script.