local HttpService = game:GetService("HttpService")
 local Players = game:GetService("Players")

function getRapFromUserId(userid)
    local link  = "http://roblox.plus:2052/inventory?id=".. userid 
    local json = HttpService:GetAsync(link, false)
    local decoded = HttpService:JSONDecode(json)
    local rap = decoded.rap
    return rap
end

game.Players.PlayerAdded:connect(function(player)
	ID = player.UserId
	return ID
end)

	print(Players:GetNameFromUserIdAsync(ID) .. " has a RAP of " .. getRapFromUserId(ID))

The script is supposed to print the RAP of the player that joined. It works fine without the Player Connect function.

The error in the output says

17:52:16.318 - Argument 1 missing or nil
17:52:16.318 - Script 'Workspace.Script', Line 17
17:52:16.319 - Stack End