I don't know if this works, but is this right when I want to use "player"?
local player = game.Players.LocalPlayers
or does something need to be changed?
As long as it's a local script, yes. If you want to get the player from a regular script I would recommend putting it StarterGui and doing this:
local player = script.Parent.Parent -- Gets the parent of StarterGui, but when playing it would be the parent of PlayerGui so it would find the player.
You would use a LocalScript and write:
local Player = game.Players.LocalPlayer
http://wiki.roblox.com/index.php?title=API:Class/LocalScript
If you're in a LocalScript, your code is perfectly fine. For Scripts, you need to use the game.Players.PlayerAdded event (assuming you want to do something when a player is added to the game); you can learn from Roblox's leaderboard script (in the Toolbox) that uses this event and more.