hey i need help with a quick script! when u touch a part and u loose 25 health and if u touch it again u lose another 25 health Help!
Put this script in a Part
If this works please accept my answer.
local debounce = false local HealthLoss = 25 -- Change this to the damage you need. function OnTouched(Part) if Part.Parent ~= nil then--Keep Parentless blocks from breaking it. if debounce == false and Part.Parent:findFirstChild("Humanoid") ~= nil then debounce = true Part.Parent:findFirstChild("Humanoid"):TakeDamage(HealthLoss) wait(2)--Wait two seconds before the brick can hurt someone. debounce = false end end end script.Parent.Touched:connect(OnTouched)
man, I'll give you this script, but this isn't a website where you just ask for a script and pronto, you need to put in effort yourself. Insert inside the part this script:
script.Parent.Touched:connect(function(hit) if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 25 end end)
I won't give you it next time if you don't put forth any effort.