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

OnTouched doesn't detect anchored brick?

Well the title say all. I tried this:

script.Parent.Touched:connect(function(brick)
	if brick:IsA("BasePart") then
		print(tostring(brick))
	end
end)

It's only detects unanchored bricks but I'm looking for a script that can detect unanchored bricks if any is touching.

Sure if you use script.Parent.Anchored = false it will print the part's name .How could I make a script detects if an anchored brick, like if one is moving with CFrame.new?

I tried to make it **CanCollide ** to true and to false but not working too.

1 answer

✓ Accepted answer

Touched will fire even when the brick is anchored. If you CFrame it, though, Touched won't fire. In that case, you have to use GetTouchingParts.

Unfortunately, this is a method, not an event. But it will return a table of all parts that intersect with the one you call it on. Note that adjacent parts are not considered touching; they must intersect.

for i, part in pairs( workspace.Part:GetTouchingParts() ) do
	print( part )
end

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