I actually made a post on this same problem like this a bit ago. Here:
local function GetTouchingParts(part)
local connection = part.Touched:Connect(function() end)
local results = part:GetTouchingParts()
connection:Disconnect()
return results
end
local myPart = -- Path in workspace to the part to be checked
local player = -- Path in workspace to the player to be checked for
while true do
local touchingParts = GetTouchingParts(myPart) -- Returns a table with all touching parts
for i, v in pairs(touchingParts) do
if v.Parent == player then
-- Do whatever you'd like
end
end
end
From here: OnTouch and TouchEnded help - #5 by MJTFreeTime
EDIT: @Eestlane771 that’s a weird coincendence; you posted that right as I posted mine, and it’s from the same post!