Recent Profile Visitors

The issue is probably that your spectating function is probably only client sided and that is exactly the issue.
If you ( localPlayer ) spectate someone in another dimension it will look desynced.
If you ( localPlayer ) set your dimension to the spectated players dimension client sided and then spectate it will look desynced.
So the only solution is setting the localPlayers dimension server sided to the spectated players dimension and then start spectating.

This functions constantly loops through all players every frame, which is extremly excessive.
You could limit the looping to every 500 ms like this:
local lastDataSet = 0
local dataSetCooldown = 500 -- in ms
exports.scoreboard:scoreboardAddColumn( "Wanted", 45 )
exports.scoreboard:scoreboardAddColumn( "Money", 55 )
function ScoreBoardWanted(thePlayer)
-- if getTickCount is smaller than the last time we set the elementdata, return false, else loop through all players and set the cooldown
if ( getTickCount( ) < lastDataSet + dataSetCooldown ) then
return false
end
for _,player in ipairs( getElementsByType("player") ) do
setElementData ( player, "Wanted", getPlayerWantedLevel ( ) )
setElementData ( player, "Money", getPlayerMoney ( ) )
end
lastDataSet = getTickCount( )
end

local theTrailer = getElementData( thePlayer, "Trucker.trailer" )
destroyElement(theTrailer)
You are saving the elementdata under the variable "theTrailer" and then you try to use destroyElement on an elementdata, which doesn't work since elementdata is not an element.