GetTouchingParts() function is not returning all of the touching parts for some reason. It is only returning 1 and yes, they are all CanCollide except for the touchPart. Here is the script:
print(v) is not listing all of the touching parts.
local function goaltouchedfunc(ball,toucher)
if ball.Parent == BallsFolder then
task.delay(2, function()
for i, v in pairs(toucher:GetTouchingParts()) do
print(v)
if v.Parent == BallsFolder then
game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvents"):WaitForChild("HasGoal"):FireServer(ball)
print("yes")
else
print("no")
return
end
end
end)
end
end
AreaFolder.GOAL_1.Touched:Connect(function(ball) goaltouchedfunc(ball,AreaFolder.GOAL_1) end)
AreaFolder.GOAL_2.Touched:Connect(function(ball) goaltouchedfunc(ball,AreaFolder.GOAL_2) end)
I want to be able to see all touching parts to detect if the ball is still touching. How can I achieve that?