local touched = false

script.Parent.Touched:Connect(function(hit)
	local HRP = hit.Parent:FindFirstChild("HumanoidRootPart") or hit.Parent:FindFirstChild("Handle")
	if HRP then
		if not touched then
			touched = true
			script.Parent.Parent:FindFirstChild("Head").robotic_growling:Play()
		end
	end
end)

script.Parent.TouchEnded:Connect(function(hit)
	local HRP = hit.Parent:FindFirstChild("Torso") or hit.Parent:FindFirstChild("Handle")
	if HRP then
		if touched then
			touched = false
			script.Parent.Parent:FindFirstChild("Head").robotic_growling:Stop()
			wait()
			script.Parent.Parent.Name = "??????"
		end
	end
end)

while true do
	wait()
	if touched then
		local random = {"??????", "???????", "????????", "???????", "????????", "?????????", "??????????????????", "???????"}
		script.Parent.Parent.Name = random[math.random(1,#random)]
	end
end

yeah so basically it keeps acting like TOUCHENDED started while im still touching the part (the part has cancollide off)

2 comments

0

The Touched event is terrible for this kind of thing. Try using Region3.

0

You need a wait(1) or some other wait time when using debounce.