would help me out quite a bit
✓ ANSWER ACCEPTED
how do i check if a player is touching a part?
1 answer
✓ Accepted answer
Using part's Touched event:
The code below says when the parts touch event is fired, call the following function:
part = game.Workspace.Part
part.Touched:Connect(function(itemTouchingPart)
print("Item touching part: ", itemTouchingPart)
--Now we're going to see if the thing touching the part is a person by checking if it's parent is one of the players in game
if(itemTouchingPart.Parent and game.Players:FindFirstChild(itemTouchingPart.Parent.Name))then
print("There is a player touching the part!")
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.
