I'm trying to make a function that returns false only if ANY part in workspace is within a certain range of a part called CSprout. My attempt is below and I'm not sure what I need to do to make it work. This isn't the whole script, just the function I'm trying to fix. If I need to clarify anything let me know. Thanks!
local seed = script.Parent
local position = seed.Position
local RANGE = 5
function spaceCheck(CSprout)
local OTHER = game.Workspace:GetChildren()
for index, child in pairs(OTHER) do
print(OTHER.Name)
if OTHER:IsA("Part") and (CSprout.Position - OTHER.Position).magnitude < RANGE then
return false
else return true
end
end
end

1 comment
Thank you!