local player = game:GetService("Players").LocalPlayer
This is the script i use for player variables, somehow when i test with emulator it says its a nil value, althrough i tried with wait(0.1), and repeat wait() until player ~= nil, but it keeps doing that.
First of all, LocalPlayer should only be used on LocalScripts. If you're using with Scripts, you might want to make this:
game.Players.PlayerAdded:connect(function(player) -- actions with the player end)
If you're using actual LocalScripts, try this:
repeat wait() until game.Players repeat wait() until game.Players.LocalPlayer -- actions with localplayer
This always works for me. Test and let me know something :P