Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How could I find if a Humanoid was touching a part?

So, I put this code into a part:

part = script.Parent while true do if part.Touched then print("STOP TOUCHING ME!!!!!") end wait() if part.TouchEnded then print("Oh, Finally.") end wait() end

And it started printing infinitely because another part was touching it. Could you know how to help?

1 answer

✓ Accepted answer

Try using the event instead:

part.Touched:Connect(function(hitPart)
	if hitPart.Parent:FindFirstChildOfClass("Humanoid") then
		print("STOP TOUCHING ME!!!!!")
	end
end)
part.TouchEnded:Connect(function(hitPart)
	if hitPart.Parent:FindFirstChildOfClass("Humanoid") then
		print("Oh, Finally.") 
	end
end)

1 comment

1

Cool, thanks :)

This discussion is preserved as it was. New answers, comments, and votes are closed.