Non-Cancollide Touching Problems

Hi,

So I’m working on a game and I need to detect when the player goes through a waypoint. The waypoint in question is invisible and non-cancollide, however, it doesn’t detect the touch, except for when I enable cancollide. CanTouch and CanQuery are on, and I’m using the player’s HumanoidRootPart.

TL;DR: How would I be able to detect a touch, with a CanCollide-Off part?

onTouchTest.rbxl (35.2 KB)

Try this code in a script as a child of the part. Reference the attached roblox file as an example.

local part = script.Parent
local canTouch = true
local COOLDOWN = 1


part.Touched:Connect(function(hit)
	
	if canTouch and hit.Parent:FindFirstChild("Humanoid") then
		canTouch = false
		print("Part was touched")
	end
	task.wait(COOLDOWN)
	canTouch = true
end)

For some reason that script has made my first script work… somehow. Thanks…?

1 Like