When you play Warcraft in Multiplayer, the same game runs on multiple computers. To asure that those games actually do the same, Warcraft sends sync info between the computers.
As an example: when a unit is created, that unit needs to be created at the exact same point on all computers so Warcraft sends that location over the net and if it happens to be wrong on one computer, that computer desyncs with the rest of the game and will be forced to leave.
Usually desyncs are the result of bugs in the game or problems in the network. Now Warcraft has a special native that intentionally desyncs the game. That is GetLocalPlayer. After running
local player p = GetLocalPlayer()
p contains a different player on all computers (the player playing on that specific computer). Now you will wonder why does it not always cause a desync of the game? The reason is that Warcraft does not sync everything, some things are local and changing them on a specific computer does not desync the game. That are usually things related to input and output, but not related to the outcome of the current game.
Some Examples: Models, Skins, Displaying Text, Sound, ...
So if you have code like
if GetLocalPlayer() == Player(5) then
//some code
endif
then it is important that you only put local stuff in there and not create a unit or similar.