Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

Right now, my script looks like this:

1if script.Parent:GetTouchingParts(nil) then
2 
3end

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

2 answers

Log in to vote
0
Answered by 3 years ago

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

1if #script.Parent:GetTouchingParts() == 0 then
2 
3end
0
I will try this poop07393cfhi3n2222 4 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
1local IfTouchingPart = script.Parent:GetTouchingParts()
2 
3if not IfTouchingPart then
4    -- Code if nothing is touching the part
5end

Answer this question