That's because you put it all on one file, it should be two separate files: meta.xml, and the script that we can call it: script.lua, so it would look like this:
meta.xml:
"YourName" type="gamemode" name="My Server" description="My first MTA server" />
script.lua:
local spawnX, spawnY, spawnZ = 1959.55, -1714.46, 10
function joinHandler()
spawnPlayer(source, spawnX, spawnY, spawnZ)
fadeCamera(source, true)
setCameraTarget(source, source)
outputChatBox(" Welcome to My Server ", source)
end
addEventHandler("onPlayerJoin", getRootElement(), joinHandler)