Help with a part.touched script

Another part is touching the object and firing the event. Because it’s not a player, it does not have a character. If you want to see if a player touched the part, do

script.Parent.Touched:Connect(function(otherPart)
    local player = game:GetService("Players"):GetPlayerFromCharacter(otherPart.Parent)

    if player then
    --code goes here
    end
end)
1 Like