Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make this script only deduct a quarter of their health each time they touch it?

I would like to know how to tweak this script so it deducts 25 health instead of deducting 100 health each time some one touches it?

function onTouch(part) local human = part.Parent:findFirstChild("Humanoid") if (human == nil) then return end human.Health = 0 end script.Parent.Touched:connect(onTouch)

1 answer

✓ Accepted answer
debounce = false
function onTouch(part) 
	local human = part.Parent:FindFirstChild("Humanoid")
	if not human then
		human = part.Parent.Parent:FindFirstChild("Humanoid")
	end
	if debounce == false and human then
		debounce = true
		human:TakeDamage(25)
		wait(1)
		debounce = false
	end
end
script.Parent.Touched:connect(onTouch)

This discussion is preserved as it was. New answers, comments, and votes are closed.