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 2 years ago

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

Log in to vote
0
Answered by 2 years ago

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

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

end
0
I will try this poop07393cfhi3n2222 4 — 2y
Ad
Log in to vote
0
Answered by 2 years ago
local IfTouchingPart = script.Parent:GetTouchingParts()

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

Answer this question