function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then local character = hit.Parent local plr = game.Players:GetPlayerFromCharacter(character) if plr then plr.PlayerGui.Hull.Value.Value = plr.PlayerGui.Hull.Value.Value +1 wait(5) end if plr.PlayerGui.Hull.Value.Value == 100 then script.Disable = true wait(5) script.Disabled = false end end end
script.Parent.Touched:connect(onTouched)
You need to add 'debounce' so that the player cannot restore their Hull points by jumping on the part repeatedly. To prevent the Hull points from going beyond 100, just add an if statement that returns from the function if the Hull points are 100 or higher.
db = false function onTouched(hit) if db then return end if hit.Parent:FindFirstChild("Humanoid") then local character = hit.Parent local plr = game.Players:GetPlayerFromCharacter(character) if plr andplr.PlayerGui.Hull.Value.Value < 100 then db = true plr.PlayerGui.Hull.Value.Value = plr.PlayerGui.Hull.Value.Value +1 wait(5) db = false end end end script.Parent.Touched:connect(onTouched)