Detecting when player hits object

i need to detect when player hits any other part. simple as that

you can use the .Touched event for the part.

local players = game:GetService("Players")

local function onTouch(hit:BasePart)
    local player = players:GetPlayerFromCharacter(hit.Parent)
    if player then
        print(`@{player.Name} touched the part!`)
    end
end

YourPart.Touched:Connect(onTouch)