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

How would I make a script that checks if a part is touching nothing?

Right now, my script looks like this:

if script.Parent:GetTouchingParts(nil) then
	
end

But that doesn't work. How would I make it so that it works?

2 answers

✓ Accepted answer

try to check if the length of the table that GetTouchingParts() is returning is equal to 0:

if #script.Parent:GetTouchingParts() == 0 then
 	
end

1 comment

0

I will try this

local IfTouchingPart = script.Parent:GetTouchingParts()

if not IfTouchingPart then
    -- Code if nothing is touching the part
end

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