In a script I made located in the PlayerGui, It is a Server Sided script btw.
I use this code.
local Player = game.Players.LocalPlayer; -- Line 1 repeat wait() until Player.Character ~= nil --Line 2 local Character = Player.Character --Line 3
The error happens on Line 2, this is a script that works with a Credit GUI. Just for like buying credits for a game of mine via Developer Products.
Well first off, You should check the Wiki located at Wiki.Roblox.Com, they have most of the answers there. So check that out first next time.
But the main problem in your code is that you are using a Server Sided script. 'game.Players.LocalPlayer', only works in Local Scripts. Try using a local script and see if that will fix the problem.