I made this script and I would like to know how I can create a damage script that doesn't do mega damage such as this. It consistently ticks over and over in an instance and I can't know how to fix it. I would be happy for any help possible.
-- Damage script local rarm = script.Parent:FindFirstChild("Right Arm") local larm = script.Parent:FindFirstChild("Left Arm") function dmg(hit) if hit.Parent ~= nil then local hum = hit.Parent:findFirstChild("Humanoid") if hum ~= nil then hum.Health = hum.Health -2 end end end rarm.Touched:connect(dmg) larm.Touched:connect(dmg)
Maybe using a debounce could solve your problem.
Create the variable:
local debounce = false
Then put in your function:
if debounce == false then debounce = true --The rest of your code. end
When you want your function to work again, just set the debounce to false again with:
debounce = false
I hope that this could help you.