Answered by
5 years ago Edited 5 years ago
There is a function called GetPlayerFromCharacter(Char)
of players that gets the player object from the given character model.
01 | local mainPlayer = game.Players:GetPlayerFromCharacter(script.Parent) |
03 | part.Touched:Connect( function (hit) |
04 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
05 | local character = hit.Parent |
06 | local player = game.Players:GetPlayerFromCharacter(character) |
07 | if player ~ = mainPlayer then |
Hope this helps, if you have any questions please let me know!