Animation playing only locally, other players can't see animation

I’m playing an animation when user goes to ATM, but only the player itself can see and whoever is near can’t see the player animation. I think it’s being played only locally, how can I play it to people on the server as well?

My code:

local atms = {
    "prop_atm_01",
	"prop_atm_02",
	"prop_atm_03",
    "prop_fleeca_atm",
}
alreadyOnATM = false
user = {}
function exitATM ()
	SetNuiFocus(false, false);
	RequestAnimDict("amb@prop_human_atm@male@enter")
	while (not HasAnimDictLoaded("amb@prop_human_atm@male@enter")) do
		Citizen.Wait(1) 
	end
	TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@enter", "enter", 1.0, 1.0, 3000, 0, 1, true, true, true)
	Citizen.Wait(3000)			
	RequestAnimDict("amb@prop_human_atm@male@idle_a")
	while (not HasAnimDictLoaded("amb@prop_human_atm@male@idle_a")) do
		Citizen.Wait(1)
	end
	TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@idle_a", "idle_c", 1.0, -1.0, -1, 0, 1, true, true, true)
	ClearPedTasks(GetPlayerPed(-1))
	Citizen.Wait(6500)
	alreadyOnATM = false
end
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

end
end)
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(8)
        for i = 1, #atms do
			local nearestatm = GetClosestObjectOfType(GetEntityCoords(GetPlayerPed(-1), true), 0.9, GetHashKey(atms[i]), false)
			if DoesEntityExist(nearestatm) then
				if not alreadyOnATM then
					SetTextFont(0)
					SetTextProportional(1)
					SetTextScale(0.0, 0.3)
					SetTextColour(0, 255, 0, 255)
					SetTextDropshadow(0, 0, 0, 0, 255)
					SetTextEdge(5, 5, 0, 0, 255)
					SetTextDropShadow()
					SetTextOutline()
					SetTextEntry("STRING")
					AddTextComponentString("Pressione E para acessar o Caixa Eletrônico.")
					DrawText(0.01, 0.02)
				end
				if IsControlJustPressed(0, 38) then
					if alreadyOnATM then
						exitATM()
					else
						print(GetEntityForwardVector(nearestatm), GetEntityRotation(nearestatm))
						SetEntityHeading(GetPlayerPed(-1), GetEntityHeading(nearestatm))
						RequestAnimDict("amb@prop_human_atm@male@enter")
						while (not HasAnimDictLoaded("amb@prop_human_atm@male@enter")) do
							Citizen.Wait(1) 
						end
						TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@enter", "enter", 1.0, 1.0, 3000, 0, 1, true, true, true)
						Citizen.Wait(3000)			
						RequestAnimDict("amb@prop_human_atm@male@base")
						while (not HasAnimDictLoaded("amb@prop_human_atm@male@base")) do
							Citizen.Wait(1)
						end
						TaskPlayAnim(PlayerPedId(),"amb@prop_human_atm@male@base", "base", 1.0, -1.0, -1, 2, 1, true, true, true)
						alreadyOnATM = true
						TriggerServerEvent("user:getUserData", "atm:getUserInfo")
					end
				end
            end
		end
	end
end)
function split(str, character)
  result = {}

  index = 1
  for s in string.gmatch(str, "[^"..character.."]+") do
    result[index] = s
    index = index + 1
  end

  return result
end

RegisterNUICallback('close', function(data, cb)
	exitATM()
end)
RegisterNUICallback('deposit', function(data)
	TriggerServerEvent('user:depositMoney', data)
end)
RegisterNUICallback('withdraw', function(data)
	TriggerServerEvent('user:withdrawMoney', data)
end)
RegisterNetEvent('atm:getUserInfo')
AddEventHandler('atm:getUserInfo', function(data)
	user = data
	SetNuiFocus(true, true)
	SendNUIMessage({action = "openATM", user = user})
end)