client.js

setTick(()=>{
    let ped = PlayerPedId();
    let [x,y,z] = GetEntityCoords(ped, true);
    let color = LocalPlayer.state.pedcolor;

    DrawMarker(27, x,y,z-0.98, 0,0,0,0,0,0,2,2,2,color.r,color.g,color.b,255);
})

server.js

on('playerJoining', () => {
    // copy security source to src
    const src = global.source;

    // Generate color RGB random (0-255)
    const color = {
        r: Math.floor(Math.random() * 256),
        g: Math.floor(Math.random() * 256),
        b: Math.floor(Math.random() * 256)
    };

    // Set state bag in player
    Player(src).state.pedcolor = color ;
});