Answered by
6 years ago Edited 6 years ago
You use the .Touched
event.
This code kills the player when they step on the part.
1 | Part.Touched:Connect( function (Hit) |
2 | if Hit.Parent:FindFirstChild( "Humanoid" ) then |
3 | Hit.Parent:BreakJoints() |
Hit is the object that hit the part, we can use an if statement to check to see if the object's parent has a humanoid and if it does then it might be a player, to check if it is a player we can do
1 | Part.Touched:Connect( function (Hit) |
2 | if Hit.Parent:FindFirstChild( "Humanoid" ) and game:GetService( "Players" ) [ Hit.Parent.Name ] then |
https://www.robloxdev.com/api-reference/event/BasePart/Touched