✓ Accepted answer
It's actually a whole lot easier than Touched. First off, you need to insert a ClickDetector into the Part, along with the script. We will use the MouseClick event of the ClickDetector to detect when someone clicks.
The part of this that makes it so much easier is the built in parameters. Touched's built in parameter is the part that fired the event, so it might be equal to your left leg or something. But because anything can fire the event, you have to make sure the Humanoid exists, like you did on line 7. You then have you use GetPlayerFromCharacter to be able to use the player.
This isn't necessary for the MouseClick event. Its built in parameter is equal to the Player who clicked. This makes all those checks we did for Touched not needed. Check it out;
function onClick(player)
print(player.Name.." was found!")
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
1 comment
Use a click detector.