[HELP] Drawmarker shows up only after i restarted the resource in the F8 console

So, after i start the server and i log in , no marker is drawn. I have to open F8 console , restart the resource and then it shows every marker i had used. After i quit FiveM and then log in again, i have the same problem.

local markerPos = vector3(47.937442779541,6458.650390625,31.425298690796)

Citizen.CreateThread(function()

local ped = GetPlayerPed(-1)

while true do

    Citizen.Wait(0)

    local playerCoords = GetEntityCoords(ped)

    local distance = #(playerCoords - markerPos)

    if distance < 150.0 then

        DrawMarker(36, markerPos.x, markerPos.y, markerPos.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0, 15, 50, 200, false, true, 2, nil, nil, false)

    else

        Citizen.Wait(0)

    end

end

end)

I use a client.lua file with many of this script to show markers in the coords that i want them to be.
I’m pretty new to .lua and coding.
Any help is much appreciate it!