Its easy to do if I tried doing that if my script was in the player... but what if its in workspace? If I had a damage script, I need to get the player that it touched.
There's a method of the Players service called GetPlayerFromCharacter(). We provide the character in the parentheses.
It's rather self-explanatory -- it literally attempts to find the Player that is controlling the given character. If the player exists, it returns the player, otherwise it returns nil.
This makes it easy to get the player when using Touched events because they have a built in parameter equal to whatever did the touching. If touched by a user, the Parent of that part will be the character.
script.Parent.Touched:connect(function(hit) print(game.Players:GetPlayerFromCharacter(hit.Parent)) end)