This is my script so far; it is set as the child of a hitbox:
local debounce = false
script.Parent.Touched:connect(function(hit)
if debounce == false then
print("1")
if not script.Parent.Name == hit.Parent.Name then
print("2")
if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
print("3")
debounce = true
hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
hit.Parent.Humanoid.WalkSpeed = 8
wait(1)
hit.Parent.Humanoid.WalkSpeed = 16
debounce = false
end
end
end
end)
In line 6, I try to check if the script's parent's name is equal to the part it hit's name, but i think i did "hit.Parent.Name then" wrong. Any suggestions?

1 comment
Thanks.