Hey there! For some reason my debounce isn’t working. How would I fix the script?
script:
local isTouched = false
Snowball.Touched:Connect(function(hit)
if hit.Parent.Name == "Big elf" or hit.Parent.Name == "Santa claus" and isTouched == false then
isTouched = true
hit.Parent.Humanoid:TakeDamage(DamageValuee)
Snowball:Destroy()
if hit.Parent.Humanoid.Health <= 0 then
plr.leaderstats["Elfs defeated"].Value = plr.leaderstats["Elfs defeated"].Value + 1
end
wait(1)
isTouched = false
end
end)
The or in the if statement makes the difference. It separates the statement and check if one of them is valid. So either the name is big elf or the name is santa Claus and the denounce is false. So when the name is big elf it completely ignores the rest of the statement (also the debounce)
The solution from nyrion now checks if the name is big elf and denounce is false or the name is santa Claus and the denounce is false
if (name == "Big elf" or name == "Santa claus") and not isTouched then
is basicly the same as the code beloojust without the brackets
if name == "Santa claus" and not isTouched or name== "Big elf" and not isTouched then
explaining sucks lol so I hope you understand my explanation